Terminal putting ANSI Escape Code in terminal line when attaching tmux session #20907

Closed
opened 2026-01-31 07:27:27 +00:00 by claunia · 6 comments
Owner

Originally created by @angadschawla on GitHub (Nov 27, 2023).

Windows Terminal version

1.18.2822.0

Windows build number

10.0.22621.0

Other Software

I am using Windows terminal to connect via SSH (openSSH on Windows) to Linux machine. Once connected I run tmux attach to connect to an already running tmux session. The shell on Linux is zsh.

Steps to reproduce

Whenever I run "tmux attach -t session_name".

Expected Behavior

I should just be attaching to a detached session.

Actual Behavior

Whenever I connect to the detached session in Tmux, I get this input "61;6;7;22;23;24;28;32;42c" which seem line ANSI escape codes. This is annoying as if there is a process going in that tmux session this messes up the visual output of the script already running.

I tried running the same command on a Mac Machine using terminal and iTerm 2, and this error does not happen.

Screenshot 2023-11-27 112934
Originally created by @angadschawla on GitHub (Nov 27, 2023). ### Windows Terminal version 1.18.2822.0 ### Windows build number 10.0.22621.0 ### Other Software I am using Windows terminal to connect via SSH (openSSH on Windows) to Linux machine. Once connected I run tmux attach to connect to an already running tmux session. The shell on Linux is zsh. ### Steps to reproduce Whenever I run "tmux attach -t session_name". ### Expected Behavior I should just be attaching to a detached session. ### Actual Behavior Whenever I connect to the detached session in Tmux, I get this input "61;6;7;22;23;24;28;32;42c" which seem line ANSI escape codes. This is annoying as if there is a process going in that tmux session this messes up the visual output of the script already running. I tried running the same command on a Mac Machine using terminal and iTerm 2, and this error does not happen. <img width="843" alt="Screenshot 2023-11-27 112934" src="https://github.com/microsoft/terminal/assets/70210887/ff1d0b43-5196-493d-aa09-e2f2ffe5129c">
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 07:27:27 +00:00
Author
Owner

@j4james commented on GitHub (Nov 28, 2023):

This is quite likely the same issue as #7185. And it was suggested there that upgrading SSH might help. The other suggestion was to set a longer escape-time value in your tmux config.

@j4james commented on GitHub (Nov 28, 2023): This is quite likely the same issue as #7185. And it was suggested there that upgrading SSH might help. The other suggestion was to set a longer `escape-time` value in your tmux config.
Author
Owner

@angadschawla commented on GitHub (Nov 28, 2023):

Thank you, @j4james! That handled it. I used the escape-time suggestion.

@angadschawla commented on GitHub (Nov 28, 2023): Thank you, @j4james! That handled it. I used the `escape-time` suggestion.
Author
Owner

@gangefors commented on GitHub (Feb 23, 2024):

For anyone that ends up here and is using byobu, the tmux config is located at ~/.byobu/.tmux.conf.

This config ended up solving the issue for me.

$ cat ~/.byobu/.tmux.conf
set-option -s escape-time 50
@gangefors commented on GitHub (Feb 23, 2024): For anyone that ends up here and is using byobu, the tmux config is located at `~/.byobu/.tmux.conf`. This config ended up solving the issue for me. ``` $ cat ~/.byobu/.tmux.conf set-option -s escape-time 50 ```
Author
Owner

@noapoleon commented on GitHub (Apr 11, 2024):

This does not fix it for me.
Also I get the exact same weird numbers "61;6;7;22;23;24;28;32;42c" but twice
I am using Windows Terminal version 1.19.10821.0
image

Here's my tmux config if that helps with anything
Right now escape-time is at 10 but I have tried from 10 to 10000 and it changes nothing
image

@noapoleon commented on GitHub (Apr 11, 2024): This does not fix it for me. Also I get the exact same weird numbers "61;6;7;22;23;24;28;32;42c" but twice I am using Windows Terminal version 1.19.10821.0 ![image](https://github.com/microsoft/terminal/assets/61585882/093a51d4-b6b8-4f0e-84ab-05f494149a52) Here's my tmux config if that helps with anything Right now escape-time is at 10 but I have tried from 10 to 10000 and it changes nothing ![image](https://github.com/microsoft/terminal/assets/61585882/8d45ef99-61aa-4e6b-a380-b1969b194c88)
Author
Owner

@sheen-justin commented on GitHub (May 29, 2024):

@noapoleon I was getting pretty much the exact same issue. The culprit looks to be tmux-sensible.

In ${TMUX_PLUGIN_DIR}/tmux-sensible/sensible.tmux line 83 it sets tmux set-option -s escape-time 0. You can either modify this line to be a higher value or remove tmux-sensible from your .tmux.conf

@sheen-justin commented on GitHub (May 29, 2024): @noapoleon I was getting pretty much the exact same issue. The culprit looks to be tmux-sensible. In `${TMUX_PLUGIN_DIR}/tmux-sensible/sensible.tmux` line 83 it sets `tmux set-option -s escape-time 0`. You can either modify this line to be a higher value or remove tmux-sensible from your .tmux.conf
Author
Owner

@sheen-justin commented on GitHub (May 29, 2024):

@noapoleon another option is to move the line set -sg escape-time 10 in your .tmux.conf from up top to immediately after the line set -g @plugin 'tmux-plugins/tmux-sensible'

@sheen-justin commented on GitHub (May 29, 2024): @noapoleon another option is to move the line `set -sg escape-time 10` in your `.tmux.conf` from up top to immediately after the line `set -g @plugin 'tmux-plugins/tmux-sensible'`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20907