commit cb2b5e2780a6de8a3f3cad84cad7318535571a68
parent 39fc340276a4fdbe1f1bb4bfbe7328267ad7f9d6
Author: Yoshimasa Niwa <niw@niw.at>
Date: Mon, 22 Apr 2024 17:17:43 -0700
fix(tui): disable DECRQM and DECRQSS queries for Terminal.app (#28453)
**Problems**
When launching Neovim on Terminal.app on macOS (Apple Terminal),
it briefly shows like
`p$qm+q5463;524742;73657472676266;73657472676262$qm` in orange
background color partially on the screen.
**Solution**
Since Terminal.app seems not supporting DECRQM and DECRQSS queries,
calling `tui_request_term_mode` and `tui_query_extended_underline`
caused this unexpected output.
Therefore, if we know it's Apple Terminal (when `nsterm` is `true`),
don't call these checks.
Tested on Terminal.app (2.14, 453) on macOS 14.4.1.
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
@@ -410,11 +410,15 @@ static void terminfo_start(TUIData *tui)
// Query support for mode 2026 (Synchronized Output). Some terminals also
// support an older DCS sequence for synchronized output, but we will only use
- // mode 2026
- tui_request_term_mode(tui, kTermModeSynchronizedOutput);
+ // mode 2026.
+ // Some terminals (such as Terminal.app) do not support DECRQM, so skip the query.
+ if (!nsterm) {
+ tui_request_term_mode(tui, kTermModeSynchronizedOutput);
+ }
// Don't use DECRQSS in screen or tmux, as they behave strangely when receiving it.
- if (tui->unibi_ext.set_underline_style == -1 && !(screen || tmux)) {
+ // Terminal.app also doesn't support DECRQSS.
+ if (tui->unibi_ext.set_underline_style == -1 && !(screen || tmux || nsterm)) {
// Query the terminal to see if it supports extended underline.
tui_query_extended_underline(tui);
}