wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

Visual Text Jump Bug?

Open zQueal opened this issue 1 month ago • 3 comments

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

Windows

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

No response

WezTerm version

wezterm 20240203-110809-5046fc22

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

I've enabled CTRL+SHIFT+K to clear scrollback and viewport:

    -- Clear Scrollback (CTRL+k)
    {
      key = 'k',
      mods = 'CTRL|SHIFT',
      action = act.ClearScrollback 'ScrollbackAndViewport'
    },

After using it, when typing anything else into the prompt to continue using the instance, there's a weird bug where the text "jumps" to another position within the screen. I've attached a screenshot below.

Image

To Reproduce

  1. Launch wezterm
  2. Do work
  3. Trigger action = act.ClearScrollback 'ScrollbackAndViewport' via CTRL+SHIFT+K
  4. Begin typing again
  5. Text jumps to semi-random position

Configuration

local wezterm = require "wezterm"
local act = wezterm.action

return {
  -- General Settings
  hide_tab_bar_if_only_one_tab = false,
  default_prog = { "elvish.exe" },
  window_background_opacity = 1.0, -- Added .0 for clarity
  window_close_confirmation = "NeverPrompt",
  skip_close_confirmation_for_processes_named = { "elvish", "elvish.exe", "cmd", "cmd.exe" },
  scrollback_lines = 3500,
  initial_cols = 150,
  initial_rows = 40,

  -- Appearance
  font = wezterm.font("MonoLisa Nerd Font Mono"),
  font_size = 10.0,
  color_scheme = "Gruvbox dark, medium (base16)",

  -- Keybindings
  keys = {
    -- Split Horizontal (CTRL+SHIFT+|)
    {
      key = "|",
      mods = "CTRL|SHIFT",
      action = act.SplitHorizontal {domain = "CurrentPaneDomain"}
    },
    -- Split Vertical (CTRL+SHIFT+_)
    {
      key = "_",
      mods = "CTRL|SHIFT",
      action = act.SplitVertical {domain = "CurrentPaneDomain"}
    },
    -- Pane Navigation
    {
      key = "LeftArrow",
      mods = "CTRL|SHIFT",
      action = act.ActivatePaneDirection "Left"
    },
    {
      key = "RightArrow",
      mods = "CTRL|SHIFT",
      action = act.ActivatePaneDirection "Right"
    },
    {
      key = "UpArrow",
      mods = "CTRL|SHIFT",
      action = act.ActivatePaneDirection "Up"
    },
    {
      key = "DownArrow",
      mods = "CTRL|SHIFT",
      action = act.ActivatePaneDirection "Down"
    },
    -- Clear Scrollback (CTRL+k)
    {
      key = 'k',
      mods = 'CTRL|SHIFT',
      action = act.ClearScrollback 'ScrollbackAndViewport'
    },
    -- Launch NuShell (ALT+n)
    {
      key = 'n',
      mods = 'ALT',
      action = act.SendString 'nu.exe\n'
    },
    -- SHIFT+Enter custom sequence
    {
      key="Enter",
      mods="SHIFT",
      action=wezterm.action{SendString="\x1b\r"}
    }
  },
}

Expected Behavior

No response

Logs

No response

Anything else?

No response

zQueal avatar Dec 06 '25 06:12 zQueal

Have you tried with a different shell like bash?

It might be that the shell (elvish) keeps the know cursor location and it doesn't get hinted that the cursor position changed with the terminal-level clear 🤔

bew avatar Dec 06 '25 10:12 bew

I've just tried this with bash (BusyBox v1.37.0-FRP-5467-g9376eebd8 (2024-09-15 08:56:36 UTC)), and it does not happen.

Interesting.

zQueal avatar Dec 06 '25 20:12 zQueal

The title still says elvish.exe, but this is actually ash shell, and it still happens. Going to test more with bash to see if I can replicate it.

Image

zQueal avatar Dec 06 '25 20:12 zQueal