wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.28k stars 781 forks source link

Wezterm triggers tmux search on startup #813

Closed ruffson closed 3 years ago

ruffson commented 3 years ago

Describe the bug

Thanks for the great work, wezterm is an amazing terminal!

I just set up the most important things in wezterm to try it out. But when I open Wezterm, it shows the tmux search which I would usually get at with Ctrl+b (tmux key) + [ (copy mode) + / (searching).

So somehow, something on startup seems to trigger this combo.

Environment (please complete the following information):

To Reproduce

All I have to do to reproduce is just open Wezterm and I am in tmux' search mode.

Configuration

This is my tmux config. and my wezterm config is:

local wezterm = require 'wezterm';
return {
  color_scheme = "MaterialOcean",
  font = wezterm.font("JetBrainsMono Nerd Font"),
  font_size = 13,
  warn_about_missing_glyphs = false,
  window_decorations = "NONE",
  enable_tab_bar = false,
  enable_csi_u_key_encoding = true,
}

I tried setting the csi_u_key but that did not help.

Expected behavior

Don't do anything on startup.

Screenshots

Screenshot from 2021-05-22 08-57-25

ruffson commented 3 years ago

Hm it does not happen anymore, not sure what was going on. Sorry about that.

Edit: It still does happen occasionally. But not sure why it would and sometimes wouldn't.

bew commented 3 years ago

Do you see the same (occasional) behavior on other terminals?

ruffson commented 3 years ago

Do you see the same (occasional) behavior on other terminals?

Nope. I used Kitty and GNOME terminal before. I also noticed that when this happens, wez also took noticeably longer than normal: maybe 2,3 seconds with the above behavior and 1s max when starting up normal.

ruffson commented 3 years ago

Also this is how my fish shell is starting up tmux on startup:

# >>> Start TMUX on login >>>
if status is-interactive
    and not set -q TMUX
    exec tmux
end
# <<< Start TMUX on login <<<
wez commented 3 years ago

Please start wezterm using: WEZTERM_LOG=wezterm_term=trace wezterm 2> /tmp/wezterm.txt. When it reproduces, attach /tmp/wezterm.txt to this issue. That trace will log the escape sequences (and all other output) that were sent to the terminal.

ruffson commented 3 years ago

Please start wezterm using: WEZTERM_LOG=wezterm_term=trace wezterm 2> /tmp/wezterm.txt. When it reproduces, attach /tmp/wezterm.txt to this issue. That trace will log the escape sequences (and all other output) that were sent to the terminal.

Thank you so much! I could reproduce it (second startup), the log is here:

wezterm.txt

wez commented 3 years ago

I don't see anything super obvious. The one thing that seems suspect is this:

18: 2021-05-22T15:33:28.767Z DEBUG wezterm_term::terminalstate > perform CSI(Device(RequestPrimaryDeviceAttributes))
19: 2021-05-22T15:33:28.767Z DEBUG wezterm_term::terminalstate > perform CSI(Unspecified(Unspecified { params: [Integer(1337)], intermediates: [], ignored_extra_intermediates: false, control: 'n' }))

Looks like something is trying to use CSI 1337 n as a sequence, coupled with a query of the device attributes. I've seen some terminal feature probe snippets use something like that to probe to see if optional features are present, but it's usually the other way around: probe for the one you want and then the primary attributes so that you know that when you get the primary attributes you got the answer to the thing you wanted.

I've not heard of CSI 1337 n as a sequence; iTerm2 uses OSC 1337 for a number of things but not CSI. (CSI is ESC [ and OSC is ESC ]).

Do you know where that is coming from?

Does this issue reproduce if you run wezterm start tmux to launch directly into tmux?

ruffson commented 3 years ago

Do you know where that is coming from?

Hm no, my tmux has almost no plugins. Could it be on the shell level? E.g. a fish plugin? Or the anaconda hook?

In my .tmux.conf I set my terminal like this:

set -g default-terminal "xterm-256color"
set -ag terminal-overrides ",xterm-256color:RGB"

Does this issue reproduce if you run wezterm start tmux to launch directly into tmux?

Yep it does.

If this is just a fringe bug that I experience due to some weird combo of my setup then its ok. I don't want to pull away too much of your resources! I really enjoy the editor and if I occasionally have to double return or double escape, that is still fine with me. Thank you so much for your work!

bew commented 3 years ago

@ruffson did you found what was going on?

I'm not asking for me, but maybe it can help someone with the same problem later (:

ruffson commented 3 years ago

@ruffson did you found what was going on?

I'm not asking for me, but maybe it can help someone with the same problem later (:

Nope I guess that this is just too specific to my setup and I don't wanna clutter your issues.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.