Open
Description
openedon Mar 14, 2017
Problem
#25856 implemented v:termresponse
but we don't yet use it to detect whether we can use 8-bit key sequences.
Related Vim help:
> > > > > > xterm-8bit xterm-8-bit
Xterm can be run in a mode where it uses 8-bit escape sequences. The CSI code
is used instead of <Esc>[. The advantage is that an <Esc> can quickly be
recognized in Insert mode, because it can't be confused with the start of a
special key.
For the builtin termcap entries, Vim checks if the 'term' option contains
"8bit" anywhere. It then uses 8-bit characters for the termcap entries, the
mouse and a few other things. You would normally set $TERM in your shell to
"xterm-8bit" and Vim picks this up and adjusts to the 8-bit setting
automatically.
When Vim receives a response to the t_RV (request version) sequence and it
starts with CSI, it assumes that the terminal is in 8-bit mode and will
convert all key sequences to their 8-bit variants.
Expected behavior
Nvim should detect whether it can use 8-bit mode, via a "request version" TermResponse
(aka "Primary Device Attributes"?). Unless there's a better way.
Reference
- Vim in some cases does a synchronous timeout-based check, e.g.: vim/vim@ba6ec18#diff-366ece1c6e8026aed5df9c6ae82c3967R2622
- S8C1T mode