wezterm: more fun with SS3 vs CSI and cursor key encoding

I noticed that we still weren't quite right.
I think the net change is really just that we must force
the use of the CSI representation when using CTRL/SHIFT
modifiers.

refs: https://github.com/wez/wezterm/issues/203
This commit is contained in:
Wez Furlong committed 2020-06-01 18:59:18 -07:00
1 parent f6171056f0
commit 42e2775f36
2 files changed
+12 -8

No files matched your search

+2 -1
View File
@@ -107,7 +107,8 @@ mod test;
/// certain feature sets.
pub const DEVICE_IDENT: &[u8] = b"\x1b[?6c";
pub const CSI: &[u8] = b"\x1b[";
pub const CSI: &str = "\x1b[";
pub const OSC: &[u8] = b"\x1b]";
pub const ST: &[u8] = b"\x1b\\";
pub const SS3: &str = "\x1bO";
pub const DCS: &[u8] = b"\x1bP";
+10 -7
View File
@@ -644,19 +644,22 @@ impl TerminalState {
};
let csi_or_ss3 = if force_app
|| (self.application_cursor_keys
&& self.dec_ansi_mode
&& self.application_keypad)
{
|| (
self.application_cursor_keys
// Strict reading of DECCKM suggests that application_cursor_keys
// only applies when DECANM and DECKPAM are active, but that seems
// to break unmodified cursor keys in vim
/* && self.dec_ansi_mode && self.application_keypad */
) {
// Use SS3 in application mode
"\x1bO"
SS3
} else {
// otherwise use regular CSI
"\x1b["
CSI
};
if mods.contains(KeyModifiers::SHIFT) || mods.contains(KeyModifiers::CTRL) {
write!(buf, "{}1;{}{}", csi_or_ss3, 1 + encode_modifiers(mods), c)?;
write!(buf, "{}1;{}{}", CSI, 1 + encode_modifiers(mods), c)?;
} else {
if mods.contains(KeyModifiers::ALT) {
buf.push(0x1b as char);