From ad91e3776808507cbef9e6d758b89d7ca92a4c7e Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 6 Apr 2022 20:44:53 -0700 Subject: [PATCH] Secondary DA response -> vt220, version 277 This persuades vim to set ttymouse=sgr by default. We're carefully sitting below 279 which triggers some queries for things that we don't respond to yet. refs: https://github.com/wez/wezterm/issues/1825 --- docs/changelog.md | 1 + term/src/terminalstate/mod.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index e37aac979..5ef6849db 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -25,6 +25,7 @@ As features stabilize some brief notes about them will accumulate here. * Color schemes: [Retro](colorschemes/r/index.md#retro), [GitHub Dark](colorschemes/g/index.md#github-dark), [Blazer](colorschemes/b/index.md#blazer) * Wayland: touchpad scroll is now more responsive/precise. Thanks to [@davidrios](https://github.com/davidrios)! [#1800](https://github.com/wez/wezterm/pull/1800) * Kitty image protocol: now also supports shared memory data transmission. Thanks to [@tantei3](https://github.com/tantei3)! [#1810](https://github.com/wez/wezterm/pull/1810) +* Secondary DA response bumped up to persuade vim to set `ttymouse=sgr` by default. [#1825](https://github.com/wez/wezterm/issues/1825) #### Fixed * Incorrect csi-u encoding with non-ascii characters. [#1746](https://github.com/wez/wezterm/issues/1746) diff --git a/term/src/terminalstate/mod.rs b/term/src/terminalstate/mod.rs index 1b8bef0d7..1d9098132 100644 --- a/term/src/terminalstate/mod.rs +++ b/term/src/terminalstate/mod.rs @@ -1204,7 +1204,18 @@ impl TerminalState { self.writer.flush().ok(); } Device::RequestSecondaryDeviceAttributes => { - self.writer.write(b"\x1b[>0;0;0c").ok(); + // Response is: Pp ; Pv ; Pc + // Where Pp=1 means vt220 + // and Pv is the firmware version. + // Pc is always 0. + // Because our default TERM is xterm, the firmware + // version will be considered to be equialent to xterm's + // patch levels, with the following effects: + // pv < 95 -> ttymouse=xterm + // pv >= 95 < 277 -> ttymouse=xterm2 + // pv >= 277 -> ttymouse=sgr + // pv >= 279 - xterm will probe for additional device settings. + self.writer.write(b"\x1b[>1;277;0c").ok(); self.writer.flush().ok(); } Device::RequestTertiaryDeviceAttributes => {