Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmux prints chars on session start #61

Open
skwde opened this issue Jun 18, 2021 · 13 comments
Open

tmux prints chars on session start #61

skwde opened this issue Jun 18, 2021 · 13 comments

Comments

@skwde
Copy link

skwde commented Jun 18, 2021

On session start tmux prints 0;10;1c.
See also here: microsoft/WSL#5931.

This seems to be related to escape-time.
In ~/.tmux.conf

set -sg escape-time 10

fixes the issue for me.

@roachsinai
Copy link

Seems it works only for the first time start a Session, if you exit current session and run tmux again, prints chars again.

@bruno-
Copy link
Member

bruno- commented Jul 16, 2021

Can we somehow identify WSL (with an env var for example) so we can set escape-time 10 just in that case?

@roachsinai
Copy link

@bruno- but for my case problem didn't slove by set it prefectly.

@bruno-
Copy link
Member

bruno- commented Jul 16, 2021

@roachsinai , hm ok, I understand now.
Well, I'd be ok with fixing the problem for the first try at least.

Please update this thread if you find a proper solution.

@trallnag
Copy link

trallnag commented Oct 2, 2021

@roachsinai, is your issue reproducible? For me setting tmux set-option -g escape-time 50 completely fixed the issue and it does not reappear when detaching and attaching to a session.


Edit: I was too eager to announce the issue being solved for me. I have all my config (except declaration of plugins) in a shell script that I call with run-shell and the characters only stop appearing when I place set-option -g escape-time 50 right in front of the run-shell.

@avysk
Copy link

avysk commented Apr 9, 2023

I have very much the same issue not in WSL but on FreeBSD 13.1 and FreeBSD 14.0 (ssh-ed in from Windows Terminal). Increasing escape-timeout seems to fix the problem.

aaronbieber added a commit to aaronbieber/dotfiles that referenced this issue May 7, 2023
I don't know why I had set it to 0 before, but using oh-my-zsh to
auto-start tmux with an escape time of 0 causes it to spit out some
ANSI shit every time. Changing it to 50 fixes that.

See tmux-plugins/tmux-sensible#61
@tsautumn
Copy link

This reduces the frequency of the problem for me, but does not eliminate it. I'm shelling from Windows 11 into a remote Debian Bullseye bash. I have tried escape-time values of 0, 10, 20, and 50.

@niqodea
Copy link

niqodea commented Aug 24, 2023

I also have escape-time set to 0 and having this issue in the Windows 11 command prompt SSHing into an Ubuntu server when using tmux version 3.2a and newer.

Interestingly, this problem does not occur in the older version 3.1c.

Setting escape-time to something greater than 0 also works, but I prefer sticking to the older TMUX version at this point. Hoping this issue will be addressed some day 🤞

@dsjstc
Copy link

dsjstc commented Aug 28, 2023

The problem still occurs for me after downgrading to 3.1c on Debian Bullseye.

@niqodea
Copy link

niqodea commented Oct 30, 2023

I think I might have fixed it. For some reason, setting the environment variable TERM to tmux-256color before attaching to tmux seems to solve the problem for me. I will update this post if this ends up not working. Let me know if it also works for you.

EDIT: thinking about it a bit more, it makes sense that this solves the issue. The terminal is no longer queried for the capabilities by tmux, because tmux already has already been told about the capabilities via TERM.

For reference, this what I put in my .profile to fix it, explain why it works, and the assumption behind it.

@Eryx5502
Copy link

I think I might have fixed it. For some reason, setting the environment variable TERM to tmux-256color before attaching to tmux seems to solve the problem for me. I will update this post if this ends up not working. Let me know if it also works for you.

This does solve the problem also for me (I used to have TERM=xterm-256color, but changes the colours on my nvim theme, which is kind of uncomfortable.

@dsjstc
Copy link

dsjstc commented Oct 30, 2023

Thanks, this works for me too. Great workaround.

tot0rokr added a commit to tot0rokr/bash that referenced this issue Jan 25, 2024
@henrychea
Copy link

henrychea commented Feb 8, 2024

Late to the convo but if you just want to change the TERM for tmux only you can add this to the top of your tmux.conf file

set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",tmux-256color:Tc"

Edit: needs override as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants