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

Strange characters appeared when entering Tmux #5931

Closed
hexh250786313 opened this issue Sep 16, 2020 · 20 comments
Closed

Strange characters appeared when entering Tmux #5931

hexh250786313 opened this issue Sep 16, 2020 · 20 comments

Comments

@hexh250786313
Copy link

hexh250786313 commented Sep 16, 2020

Environment

Windows build number: Microsoft Windows [ver 10.0.19041.508]
Your Distribution version: Ubuntu 20.04
Whether the issue is on WSL 2 and/or WSL 1: WSL 2
Tmux ver: tmux next-3.3

Steps to reproduce

  1. On WSL 2
  2. Create a new session on tmux. I execute: tmux new -s test, then enter the session.
  3. Or attach an old session: tmux attach -t test

Expected behavior

no strange characters

Actual behavior

There are some strange characters appeared before the cursor. They are 0;10;1c. Like this:

image

But it didn't always happen. This is a chance event.

@hexh250786313
Copy link
Author

And it happened in both my desktop and laptop.

@hexh250786313
Copy link
Author

And it didn't happened in WSL 1. But my WSL 1 is Ubuntu 18.04. I'm not sure this is related to the Linux version or the WSL version.

@hexh250786313
Copy link
Author

hexh250786313 commented Sep 16, 2020

Ok, I finally resolved it. It happened when tmux run on Ubuntu 20.04. When your .tmux.conf has the line set -sg escape-time 0, it happens.

On Ubuntu 18.04, I add this line because there is a delay when I press Esc key. But if I add the line set -sg escape-time 0 on 20.04, The strange characters appear. I think it is because of the 0s. Finally I change it to 50ms (500ms default).

So I just need to change the line to set -sg escape-time 50 on 20.04 and issue resolved.

@kcking
Copy link

kcking commented Apr 21, 2021

Ok, I finally resolved it. It happened when tmux run on Ubuntu 20.04. When your .tmux.conf has the line set -sg escape-time 0, it happens.

On Ubuntu 18.04, I add this line because there is a delay when I press Esc key. But if I add the line set -sg escape-time 0 on 20.04, The strange characters appear. I think it is because of the 0s. Finally I change it to 50ms (500ms default).

So I just need to change the line to set -sg escape-time 50 on 20.04 and issue resolved.

Thank you for reporting your solution! This fixed my issue as well, I was also seeing 0;10;1c on tmux start (using wezterm and tmux on wsl2 debian).

@kchen0x
Copy link

kchen0x commented May 27, 2021

It helps!

tony added a commit to tony/tmux-config that referenced this issue Jun 15, 2021
When entering with tmux 3.2+ w/ tmuxp, characters show: 0;10;1c
microsoft/WSL#5931
@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.

Originally posted by @roachsinai in tmux-plugins/tmux-sensible#61 (comment)

@trallnag
Copy link

trallnag commented Oct 2, 2021

For me only thing that fixed the characters appearing was placing set -g escape-time 50 right at the beginning of my tmux.conf before using run-shell to source a shell script that contains the bulk of my configuration.

tmux-plugins/tmux-sensible#61 (comment)

shiomiyan pushed a commit to shiomiyan/dotfiles that referenced this issue Dec 11, 2021
fasterthanlime added a commit to fasterthanlime/dotfiles that referenced this issue Dec 12, 2021
kianby added a commit to kianby/dotfiles that referenced this issue Dec 30, 2021
speg03 added a commit to speg03/dotfiles that referenced this issue Jan 26, 2022
daephx added a commit to daephx/dotfiles that referenced this issue Feb 22, 2022
prevents '0;10;1c' from being printed, cf.

Fix: `microsoft/WSL#5931`
andreykaipov added a commit to andreykaipov/nix that referenced this issue Mar 16, 2022
andreykaipov added a commit to andreykaipov/nix that referenced this issue Mar 16, 2022
sunaku added a commit to sunaku/home that referenced this issue Jul 9, 2022
WezTerm would inject this version string into tmux as human-typed input:

  0;10;1c>|WezTerm 20220408-101518-b908e2dd

This would trigger my Alt+Shift+P shortcut in tmux, prompting for input.
Pressing anything other than escape at this point would crash tmux 3.2a.

This patch solves the problem by slowing down tmux's recognition of my
escape key presses.  See microsoft/WSL#5931
sunaku added a commit to sunaku/home that referenced this issue Jul 10, 2022
WezTerm would inject this version string into tmux as human-typed input:

  0;10;1c>|WezTerm 20220408-101518-b908e2dd

This would trigger my Alt+Shift+P shortcut in tmux, prompting for input.
Pressing anything other than escape at this point would crash tmux 3.2a.

This patch solves the problem by slowing down tmux's recognition of my
escape key presses.  See microsoft/WSL#5931
alexwh added a commit to alexwh/dotfiles that referenced this issue Jul 20, 2022
sunaku added a commit to sunaku/home that referenced this issue Jul 29, 2022
WezTerm would inject this version string into tmux as human-typed input:

  0;10;1c>|WezTerm 20220408-101518-b908e2dd

This would trigger my Alt+Shift+P shortcut in tmux, prompting for input.
Pressing anything other than escape at this point would crash tmux 3.2a.

This patch solves the problem by slowing down tmux's recognition of my
escape key presses.  See microsoft/WSL#5931
sunaku added a commit to sunaku/home that referenced this issue Aug 22, 2022
WezTerm would inject this version string into tmux as human-typed input:

  0;10;1c>|WezTerm 20220408-101518-b908e2dd

This would trigger my Alt+Shift+P shortcut in tmux, prompting for input.
Pressing anything other than escape at this point would crash tmux 3.2a.

This patch solves the problem by slowing down tmux's recognition of my
escape key presses.  See microsoft/WSL#5931
test482 added a commit to test482/dotfiles that referenced this issue Sep 2, 2022
@quique0194
Copy link

quique0194 commented Oct 24, 2022

It seems like "tmux-sensible" plugins sets escape-time=0

>> grep escape-time -R .tmux/plugins
.tmux/plugins/tmux-sensible/README.md:set -s escape-time 0
.tmux/plugins/tmux-sensible/sensible.tmux:      if server_option_value_not_changed "escape-time" "500"; then
.tmux/plugins/tmux-sensible/sensible.tmux:              tmux set-option -s escape-time 0

@Blosberg
Copy link

Blosberg commented Oct 31, 2022

Apparently the option in "sensible" is to avoid this issue, and the escape-time parameter will

'Set the time in milliseconds for which tmux waits after an escape is input to determine if it is part of a function or meta key sequences

Considering that, I think it would be advisable to set it as low as possible. I had the same problem as OP (with the exact same characters: 0;10;1c) when there was nothing in my .tmux.conf about escape time (because the value was being set by the "sensible" plugin to zero). When I explicitly set the value in .tmux.conf

set -sg escape-time 50

The weird character problem went away. Then when I set

set -sg escape-time 0

The problem came back. So that's what's causing it, but I don't want to have a lag when leaving insert mode, so I set the following:

set -sg escape-time 1 (which will allow 1 millisecond to escape insert mode --imperceptible to any human user, but enough to avoid these characters)

parsiad added a commit to parsiad/rc that referenced this issue Nov 10, 2022
wojciechkl added a commit to wojciechkl/env-config that referenced this issue Dec 15, 2022
Przy starcie tmux pod WSL2 wyskakiwały znaki 0;10;1c
Poprawka zgodnie z sugestią ze zgłoszenia microsoft/WSL#5931
mhtoribio added a commit to mhtoribio/dotfiles that referenced this issue Apr 28, 2023
rkitover added a commit to rkitover/tmux-screen-compat that referenced this issue Jun 20, 2023
Change escape-time from 0 to 1 (millisecond) to work around an issue on
earlier versions of WSL:

microsoft/WSL#5931
.

This is imperceptible in vim and is the recommended solution in that
issue.

Signed-off-by: Rafael Kitover <[email protected]>
QimatLuo pushed a commit to QimatLuo/tmux that referenced this issue Jun 20, 2023
@alinademi
Copy link

Ok, I finally resolved it. It happened when tmux run on Ubuntu 20.04. When your .tmux.conf has the line set -sg escape-time 0, it happens.

On Ubuntu 18.04, I add this line because there is a delay when I press Esc key. But if I add the line set -sg escape-time 0 on 20.04, The strange characters appear. I think it is because of the 0s. Finally I change it to 50ms (500ms default).

So I just need to change the line to set -sg escape-time 50 on 20.04 and issue resolved.

Thanks! I confirm that this solved the issue! 🙏🏼

alexandru-dinu added a commit to alexandru-dinu/gizmos that referenced this issue Aug 26, 2023
@pushpendra1x
Copy link

pushpendra1x commented Aug 30, 2023

For me any value other than 0 is working in below command:

set -sg escape-time 1

I put above in .tmux.conf

@smprather
Copy link

It's great that there's a work-around (and I will be using it), but did anyone try to root-cause and fix properly?

@smprather
Copy link

Note: I never had this problem with KiTTY. I am only seeing it now that I am trying to switch to Alacritty. Due to flakiness of the network I work on, I get a good number of disconnect/reconnects. Each reconnect to tmux generates this string. So I see it constantly. And it is not just "terminal noise". It is registering as real keystrokes to bash. This is what I see after a weekend of not working. (I hit Enter to verify that the chars were recognized by bash)

$ 0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c0;10;1c                                                                                                                                                      bash: 10: command not found
bash: 1c0: command not found
bash: 10: command not found
bash: 1c0: command not found
bash: 10: command not found
bash: 1c0: command not found

me-nkr added a commit to me-nkr/dotfiles that referenced this issue Oct 22, 2023
- add session recover strategy for neovim ( not working )
patrickdappollonio added a commit to patrickdappollonio/dotfiles that referenced this issue Oct 23, 2023
@Dan1jel
Copy link

Dan1jel commented Nov 1, 2023

Also started to see this issue... dont know why but when i start a tmux new -s Big_letter_at_start it usually showd thouse wierd symols, but when i had all lowered case i didnt see it (set -s escape-time 1).

when i removed the line set -s escape-time 1 with # it all seams to work as intended...

angramainyu74 added a commit to angramainyu74/configs that referenced this issue Nov 1, 2023
change escape time to 1 to avoid extra escapes codes showing up in wsl (microsoft/WSL#5931)
@chrismferguson
Copy link

chrismferguson commented Nov 11, 2023

for anyone having it not work, place the set -s escape-time 1 line after the tmux sensible line.

@stewartli
Copy link

it happens to me after upgraded Ubuntu (V22). nothing above works for me.

@arecarn
Copy link

arecarn commented Nov 27, 2023

A related question similar to this was answered here: https://serverfault.com/a/1130091/481120.

Here's the relevant part of the answer:

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).

fur0ut0 pushed a commit to fur0ut0/.config that referenced this issue Dec 6, 2023
doupongzeng pushed a commit to doupongzeng/dotfile that referenced this issue Dec 12, 2023
lcdsmao added a commit to lcdsmao/dotfiles that referenced this issue Jan 3, 2024
@baydakovss
Copy link

set -s escape-time 1
In my case the issue disappeared when I put "tmux-sensible" and the workaround with "escape-time" just before initializing the plugins by plugin manager

set -g @plugin 'tmux-plugins/tmux-sensible'
# Workaround. Prevent appearing 0;10;1c when tmux start
set -sg escape-time 1
#
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

brandoncardoso added a commit to brandoncardoso/.dotfiles that referenced this issue Jan 8, 2024
@ariusxi
Copy link

ariusxi commented Jan 18, 2024

Ok, I finally resolved it. It happened when tmux run on Ubuntu 20.04. When your .tmux.conf has the line set -sg escape-time 0, it happens.

On Ubuntu 18.04, I add this line because there is a delay when I press Esc key. But if I add the line set -sg escape-time 0 on 20.04, The strange characters appear. I think it is because of the 0s. Finally I change it to 50ms (500ms default).

So I just need to change the line to set -sg escape-time 50 on 20.04 and issue resolved.

Thanks man, it works for me!

tot0rokr added a commit to tot0rokr/bash that referenced this issue Jan 25, 2024
davemackintosh added a commit to davemackintosh/dotfiles that referenced this issue Mar 13, 2024
andreykaipov added a commit to andreykaipov/nix that referenced this issue Mar 17, 2024
pomupe added a commit to pomupe/dotfiles that referenced this issue Mar 21, 2024
@khayo
Copy link

khayo commented May 12, 2024

I know this is absurd and that this solution will give a loading error, but it was the only thing that made the strange characters not appear

set -sg escape-time -1

I'm using manjaro i3 with urxvt terminal

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