1
0
mirror of https://github.com/tmux/tmux.git synced 2025-04-08 09:58:49 +00:00

Increase delay to a minimum of 500 ms when requesting device attributes

This avoids treating the terminal response as user input when it comes
over a network connection.

I confirmed that this fixed the issue for me when ssh-ing from a Windows
host (Windows Terminal, OpenSSH_for_Windows_9.5) to a Linux host.
This commit is contained in:
jyn 2025-03-15 22:46:41 -04:00
parent d4b8635f50
commit 03a154da16

View File

@ -937,6 +937,16 @@ partial_key:
delay = options_get_number(global_options, "escape-time");
if (delay == 0)
delay = 1;
/* During startup, we request the Device Attributes from the terminal.
* When connecting via ssh, the response is sometimes broken over multiple TCP packets,
* and the delay would cause us to treat the escape code as user input.
* See https://github.com/PowerShell/Win32-OpenSSH/issues/2275 for more information.
* Raise the delay temporarily until we see a response. */
if (delay < 500 && (tty->flags & TTY_ALL_REQUEST_FLAGS) != TTY_ALL_REQUEST_FLAGS) {
log_debug("%s: increase delay for DA query", c->name);
delay = 500;
}
tv.tv_sec = delay / 1000;
tv.tv_usec = (delay % 1000) * 1000L;