wez / wezterm

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

Switching panes in multiple directions at once causes the focused pane to rapidly switch when any key is pressed #4390

Open illode opened 11 months ago

illode commented 11 months ago

What Operating System(s) are you seeing this problem on?

Linux Wayland

Which Wayland compositor or X11 Window manager(s) are you using?

KDE Plasma 5.27.8

WezTerm version

20231002-075348-a61cc8eb

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

If I try to change to two different panes e.g. Alt+Left+Right (using my keybinds), the pane switching completely breaks. It doesn't always happen, but it happens often enough to be a huge pain.

It's easiest to explain with a video:

https://github.com/wez/wezterm/assets/114271894/99963be2-2517-4779-a976-938c12504d46

First I spam switch panes with Alt+Random Arrow Key (custom keybind), then once it breaks I spam a random key (z). You can see the focus randomly flicker between panes.

To Reproduce

  1. Use my configuration
  2. Create multiple panes (Ctrl+p -> s -> <Arrow Key> with my config, but I don't think it really matters how they're made)
  3. Switch to multiple panes at once using Alt+<Up>+<Right> or some other combination of arrow keys. There must a pane in the directions pressed for it to break.

Configuration

local wezterm = require 'wezterm'
local act = wezterm.action

return {

  -- Keyboard Shortcuts
  leader = { key = 'p', mods = 'CTRL', timeout_milliseconds = 5000 },

  keys = {
    -- Key Tables
    { key = 'r', mods = 'LEADER', action = act.ActivateKeyTable { name = 'resize_pane', one_shot = false } },
    { key = 's', mods = 'LEADER', action = act.ActivateKeyTable { name = 'split_pane', one_shot = true } },
    { key = 'm', mods = 'LEADER', action = act.ActivateKeyTable { name = 'move_pane', one_shot = false } },

    -- Close Active Pane
    { key = 'w', mods = 'LEADER', action = act.CloseCurrentPane { confirm = false } },    
    -- Change Active Pane
    { key = 'LeftArrow', mods = 'ALT', action = act.ActivatePaneDirection 'Left' },
    { key = 'RightArrow', mods = 'ALT', action = act.ActivatePaneDirection 'Right' },
    { key = 'UpArrow', mods = 'ALT', action = act.ActivatePaneDirection 'Up' },
    { key = 'DownArrow', mods = 'ALT', action = act.ActivatePaneDirection 'Down' },

  },

  key_tables = {
    split_pane = {
      { key = 'LeftArrow', action = act.SplitPane { direction = 'Left' } },
      { key = 'RightArrow', action = act.SplitPane { direction = 'Right' } },
      { key = 'r', action = act.SplitPane { direction = 'Right' } },
      { key = 'DownArrow', action = act.SplitPane { direction = 'Down' } },
      { key = 'd', action = act.SplitPane { direction = 'Down' } },
      { key = 'UpArrow', action = act.SplitPane { direction = 'Up' } },

      { key = 'Escape', action = 'PopKeyTable' },
    },
  }
}

Expected Behavior

Pane switches without issue

Logs

14:30:54.988  ERROR  wezterm_mux_server_impl::local > writing pdu data buffer: Broken pipe (os error 32)
12:43:27.272  ERROR  wezterm_gui::frontend > Error reconciling PaneFocused notification: pane 0 not found
12:43:27.272  ERROR  wezterm_gui::frontend > Error reconciling PaneFocused notification: pane 1 not found

Anything else?

crides commented 9 months ago

This seems to be the exact same behaviour when I got #4517 (but I didn't have time to find a repro method)

osandov commented 8 months ago

I opened PR #4737 fixing this (I think), which you may want to test out. Happy New Year!

huylv commented 2 weeks ago

My work relies heavily on using terminal over SSH. I never liked tmux and found out wezterm mux worked really well so I started using it. However, when I have multiple panes, and I open a third window or resize the current one, the focus keeps switching between mux panes and a lot of errors spew out: ERROR wezterm_gui::frontend > Error reconciling PaneFocused notification: pane X not found. It's really annoying and sometimes unworkable :(

So, is there any update to this issue? I'm really looking forward to a fix for this issue.

illode commented 2 weeks ago

My work relies heavily on using terminal over SSH. I never liked tmux and found out wezterm mux worked really well so I started using it. However, when I have multiple panes, and I open a third window or resize the current one, the focus keeps switching between mux panes and a lot of errors spew out: ERROR wezterm_gui::frontend > Error reconciling PaneFocused notification: pane X not found. It's really annoying and sometimes unworkable :(

So, is there any update to this issue? I'm really looking forward to a fix for this issue.

I haven't seen the issue in a while, and with a quick test I'm not able to reproduce it anymore on at least one of my machines. Said machine has wezterm 20240203-110809-5046fc22.

I'm not sure if this would work over SSH / still works, but if I remember right, I was able to un-break it by zooming into and out of a pane. The default keybind is Ctrl + Shift + Z.