wezterm: fixup DECKPAM/DECANM/DECCKM interaction
We were treating DECCKM as the sole thing to enable application cursor reporting, but looking closely at the docs, that mode only takes effect when both DECANM (Vt52 emulation mode) AND DECKPAM (application keypad mode) are both active. neovim enables DECCKM and DECKPAM but not DECANM. refs: https://github.com/wez/wezterm/issues/203
This commit is contained in:
1 parent
7f450482a7
commit
ccf9fc141b
2 files changed
+25
-1
No files matched your search
@@ -202,6 +202,8 @@ pub struct TerminalState {
|
||||
/// keys. The code in key_down() is responsible for interpreting this.
|
||||
application_cursor_keys: bool,
|
||||
|
||||
dec_ansi_mode: bool,
|
||||
|
||||
/// When set, modifies the sequence of bytes sent for keys
|
||||
/// in the numeric keypad portion of the keyboard.
|
||||
application_keypad: bool,
|
||||
@@ -303,6 +305,7 @@ impl TerminalState {
|
||||
dec_origin_mode: false,
|
||||
insert: false,
|
||||
application_cursor_keys: false,
|
||||
dec_ansi_mode: false,
|
||||
application_keypad: false,
|
||||
bracketed_paste: false,
|
||||
sgr_mouse: false,
|
||||
@@ -640,7 +643,11 @@ impl TerminalState {
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
let csi_or_ss3 = if force_app || self.application_cursor_keys {
|
||||
let csi_or_ss3 = if force_app
|
||||
|| (self.application_cursor_keys
|
||||
&& self.dec_ansi_mode
|
||||
&& self.application_keypad)
|
||||
{
|
||||
// Use SS3 in application mode
|
||||
"\x1bO"
|
||||
} else {
|
||||
@@ -1149,6 +1156,13 @@ impl TerminalState {
|
||||
self.application_cursor_keys = false;
|
||||
}
|
||||
|
||||
Mode::SetDecPrivateMode(DecPrivateMode::Code(DecPrivateModeCode::DecAnsiMode)) => {
|
||||
self.dec_ansi_mode = true;
|
||||
}
|
||||
Mode::ResetDecPrivateMode(DecPrivateMode::Code(DecPrivateModeCode::DecAnsiMode)) => {
|
||||
self.dec_ansi_mode = false;
|
||||
}
|
||||
|
||||
Mode::SetDecPrivateMode(DecPrivateMode::Code(DecPrivateModeCode::ShowCursor)) => {
|
||||
self.cursor_visible = true;
|
||||
}
|
||||
|
||||
@@ -458,7 +458,17 @@ pub enum DecPrivateMode {
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, FromPrimitive, ToPrimitive)]
|
||||
pub enum DecPrivateModeCode {
|
||||
/// https://vt100.net/docs/vt510-rm/DECCKM.html
|
||||
/// This mode is only effective when the terminal is in keypad application mode (see DECKPAM)
|
||||
/// and the ANSI/VT52 mode (DECANM) is set (see DECANM). Under these conditions, if the cursor
|
||||
/// key mode is reset, the four cursor function keys will send ANSI cursor control commands. If
|
||||
/// cursor key mode is set, the four cursor function keys will send application functions.
|
||||
ApplicationCursorKeys = 1,
|
||||
|
||||
/// https://vt100.net/docs/vt510-rm/DECANM.html
|
||||
/// Behave like a vt52
|
||||
DecAnsiMode = 2,
|
||||
|
||||
/// https://vt100.net/docs/vt510-rm/DECCOLM.html
|
||||
Select132Columns = 3,
|
||||
/// https://vt100.net/docs/vt510-rm/DECSCLM.html
|
||||
|
||||
Reference in new issue
Block a user