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 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

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.

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.

-- 
Paul "LeoNerd" Evans

[email protected]
http://www.leonerd.org.uk/  |  https://metacpan.org/author/PEVANS

-- 
-- 
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.

Raspunde prin e-mail lui