wez / wezterm

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

Duplicated key-inputs (characters, commands) #3609

Open letavocado opened 1 year ago

letavocado commented 1 year ago

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

Linux Wayland

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

mutter 43.4

OS: Arch Linux x86_64 Host: XPS 17 9700 Kernel: 6.2.9-arch1-1 Shell: zsh 5.9 Resolution: 3840x2400 DE: GNOME 43.4 (Wayland) WM: Mutter CPU: Intel i9-10885H (16) @ 5.300GHz GPU: NVIDIA GeForce RTX 2060 Max-Q GPU: Intel CometLake-H GT2 [UHD Graphics]

WezTerm version

wezterm 20230408-112425-69ae8472

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

No, and I'll explain why below

Describe the bug

Screencast from 2023-04-24 00-47-17.webm

Characters (letters) or pressing enter or ctrl-c are duplicated several times (usually two, sometimes four times).

To Reproduce

I don't yet know the exact reason why the bug occurs. But it happens when I close the laptop or activate sleep. Not every time, but definitely after sleep.

If I restart wezterm everything works fine, until bug happens in next time (probably after next sleep).

Configuration

-- Pull in the wezterm API
local wezterm = require 'wezterm'

-- This table will hold the configuration.
local config ={}

-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
  config = wezterm.config_builder()
end

-- This is where you actually apply your config choices
config = {
  hide_tab_bar_if_only_one_tab = true, 
  window_decorations = "RESIZE"
}
-- For example, changing the color scheme:
config.color_scheme = 'Tokyo Night (Gogh)'

-- Font
config.font = wezterm.font 'FiraCode Nerd Font' 
-- config.font = wezterm.font 'JetBrains Mono' 

-- and finally, return the configuration to wezterm
return config

Expected Behavior

no command and characters duplication

Logs

I didn't know about Debug Overlay, so when a bug occurred, I recorded a screencast and output with journalctl.

journalctl -e | grep "wezterm"

Apr 23 23:32:31 dell-xps org.wezfurlong.wezterm.desktop[108250]: 23:32:31.588  INFO   wezterm_gui > Spawned your command via the existing GUI instance. Use wezterm start --always-new-process if you do not want this behavior. Result=SpawnResponse { tab_id: 2, pane_id: 2, window_id: 2, size: TerminalSize { rows: 24, cols: 80, pixel_width: 640, pixel_height: 384, dpi: 0 } }
Apr 23 23:32:31 dell-xps org.wezfurlong.wezterm.desktop[4797]: 23:32:31.598  ERROR  wezterm_mux_server_impl::local > writing pdu data buffer: Broken pipe (os error 32)

Anything else?

No response

wez commented 1 year ago

Sounds similar to:

letavocado commented 1 year ago

Thanks, @wez. Yes, a similar bug. Before creating an issue, I was looking for similar bugs, but apparently I was looking badly.

letavocado commented 1 year ago

Hi @wez! Thank you for awesome term :100: ! I do love wezterm :heart: !


bug still exist

journalctl -e | grep "wezterm"

Apr 29 19:07:01 dell-xps org.wezfurlong.wezterm.desktop[19249]: 19:07:01.453  INFO   wezterm_gui > Spawned your command via the existing GUI instance. Use wezterm start --always-new-process if you do not want this behavior. Result=SpawnResponse { tab_id: 1, pane_id: 3, window_id: 1, size: TerminalSize { rows: 24, cols: 80, pixel_width: 640, pixel_height: 384, dpi: 0 } }
Apr 29 19:07:01 dell-xps org.wezfurlong.wezterm.desktop[4353]: 19:07:01.460  ERROR  wezterm_mux_server_impl::local > writing pdu data buffer: Broken pipe (os error 32)

Debug Overlay

image

Screencast from 2023-04-29 19-10-15(2x speed).webm

Is there any way to proceed debugging? Feel free to ping me.

Hi @foundObjects @VarLad @LawnGnome! Do you have these bugs? (Feel free to ignore)

letavocado commented 1 year ago

I switched laptop to sleep mode again (without closing the wezterm that had the duplication) and the duplication disappeared.

MostHated commented 1 year ago

I was originally using pop_os and for 3-4 years, never had this issue, and a few weeks ago I had to switch to Ubuntu in order to meet Unity game engine support requirements, and ever since day one of installing it I have has this issue. I tried zsh, powershell, etc, and all shells I have tried have this issue, but no other terminal does.

I have tried appimage, deb, starting using wayland, started using WINIT_UNIX_BACKEND=x11 wezterm, etc and I have the issue no matter what. Most major parts of the OS are the same between pop_os and ubuntu still, as far as I remember. I am using the same config as I was prior.

It seems like the cursor moves to wherever the inlay suggestion ends but doesn't come back to the actual position once you type another character. You can see what I mean here, as I type out 'clear' and 'exit'. Screencast from 06-17-2023 03:55:51 PM.webm

It seems to act a little differently when I use zsh vs pwsh. zsh.webm

Any suggestions?

MostHated commented 1 year ago

Just wanted to throw it out there that I finally discovered a resolution that worked for me, in case it happens to help anyone else. I put this near the top of my .zshrc file.

source_file() { [ -f "${1}" ] && . "${1}"; }

if [[ $TERM == "wezterm" ]]; then 
  TERM="xterm-256color" # <-- Specifically this is what did the trick
  source_file "$HOME/.config/wezterm/wezterm.sh"
fi 
jonathanplatzer commented 1 year ago

Unfortunately I have the same problem with duplicated input, the method of setting

TERM="xterm-256color"

only seems to work sometimes