> On Tue, 15 Apr 2014 08:10:52 +0200 > Bram Moolenaar <[email protected]> wrote: > > > Whether the terminal is in 8 bit mode is the choice of the user (or > > the administrator or the system). Vim switching the terminal to 8 bit > > mode might break lots of things. Not sure what and when, since we'll > > probably only find out after doing it. Vim should be able to detect > > the terminal being in 8 bit mode and use that. > > > > So it's a matter of the user switching the terminal to 8 bit mode. > > It's nothing to do with the user. There's a control sequence to request > it. It's called S8C1T. Vim already switches the terminal into alternate > buffer, keypad-application mode, activates mouse tracking, and possibly > a few other things as well. One more can't hurt. You just switch it > back to 7-bit mode on shutdown, the same as vim does with switching off > alternate buffer, setting cursor-application mode and deactivating > mouse tracking.
This is a different settings with very different potential problems. That the other modes work gives no indication that 8-bit mode will work. Think of this: why do terminal emulators start in 7-bit mode anyway? If 8-bit mode is so great, why don't they start in 8-bit mode? > This one especially is a very safe thing to do. The logic is: > > * Always be willing to accept the one-byte CSI (0x9d) and SS3 (0x8f) > encodings of sequences > > * Send S8C1T (Esc Sp G) on startup, then make any reporting query that > would reply with a CSI response > > * If such a response is received in 8-bit encoding, then you know the > terminal accepted S8C1T, and you can be sure that all keys will now > be sent in 8-bit mode. Therefore, any received Escape (0x1b) bytes > must be Alt- prefixes or the real Escape key, and can never be CSI > or SS3 leaders In the mean time the user may have typed something, screen has refreshed, other codes may be received. All this is asynchronous, there are many ways in which it can fail. Vim may even exit before 8-bit mode is really working. > If for some reason the terminal doesn't understand S8C1T then it > doesn't matter. You'll simply never receive that 8-bit response, so > you'll never trigger the logic in step 3 to disable the Escape-prefixed > versions of CSI and SS3. It may also happen that the terminal works, but the communication channel has a problem with 8 bits (using parity bit, from the old days?). > If you're going to claim that switching on S8C1T is dangerous and the > user's problem, then I'm going to claim so is setting alternate buffer, > keypad-application and mouse tracking, and that vim should stop doing > those as well and leave them up to the user to set. All these are dangerous, but the ones that are being used have been tested, debugged and problems have been fixed. Adding a new one means it will take some time before it works reliable (or we would have to revert the change if there are problems that can't be fixed). Why don't you ask the maintainers of terminal emulaters to use 8-bit mode by default? -- hundred-and-one symptoms of being an internet addict: 58. You turn on your computer and turn off your wife. /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
