Score:1

Why is the Windows 11 terminal pushing escape sequences to Tmux?

in flag

Ssh's RemoteCommand facility can be used to automatically create/attach a tmux session, like this. In Windows, my sessions intermittently see the escape sequence ^0;10;1c or ^[[>1;1c, showing like this in my terminal:

enter image description here

This behaviour seems restricted to Windows 11, with both the Terminal and Console Host applications. It does not seem to occur on Windows 10 on any variant of cmd.exe. I'm presently working around it by running with the W11 Console Host in legacy mode, but I'd much rather use Windows Terminal.

How can I keep these escape sequences out of my tmux sessions?

Original question text with bad assumptions below:

(I now believe this is an incorrect assumption, based on the response from @user1686 below).

OpenSSH for Windows (including the current beta 9.2p1) seems to push some extra characters that look like escape sequences. In a given command window, the first ssh session has garbage inserted, such that my fresh tmux session looks like the image below. Same deal from cmd, powershell, and cygwin terminal. This does not happen if the remote command is absent, or a virgin bash command. Mysteriously, it also doesn't happen on the second, fourth, etc ssh commands.

NeilG avatar
sh flag
I'm also getting this *every* time I start a new Tmux session on Win 11 terminal using WSL Ubuntu 22. Creating new shells (panes) do not see it. I saw [this](https://github.com/tmux-plugins/tmux-sensible/issues/61) and tried this: `set -sg escape-time 10` in my `tmux.conf`, which seems to have solved it.
Autumn avatar
in flag
Thanks, and glad it worked for you! This improved things a little for me, but I still get it about 1/2 the time. I tried with escape-time of 0, 10, and 50. I've subscribed to the link, hopefully someone will post a more general solution.
Score:2
fr flag

It's the terminal's response to an ESC [ c "Request terminal attributes" that was issued by the remote program.

(\033[c "Request terminal attributes" is one of several information requests that tmux outputs to the terminal, expecting to receive similar responses as input coming from the terminal (normally they would be invisibly consumed by tmux, just like special-key sequences are).

I'm not able to reproduce this with tmux 3.3a nor with 3.2a.

Mysteriously, it also doesn't happen on the second, fourth, etc ssh commands.

Your remote command is specifically written to start a new tmux session the first time but attach to an existing session on the second, fourth, etc. connections. It's natural that they would show different behavior.

Autumn avatar
in flag
Thanks, that was useful! It appears that this only occurs on Windows 11, with both the Terminal and Console Host applications. It does *not* appear to occur with the Console Host in legacy mode, nor with Windows 10 on any variant of cmd.exe I tried. I'll update my question to avoid misleading others.
NeilG avatar
sh flag
As commented against the question you may find `set -sg escape-time 10` in your `tmux.conf` prevents this from continuing.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.