wez / wezterm

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

Strange terminal output in WSL on wezterm with tmux using yazi #6125

Open mau-mauricelim opened 2 months ago

mau-mauricelim commented 2 months ago

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

WSL Distro: Ubuntu 24.04 LTS and Alpine Linux v3.20 Yazi version: Yazi 0.3.0 and Yazi 0.3.3 Tmux version: tmux 3.4 WezTerm version: wezterm 20240203-110809-5046fc22

The issue is not present on Windows Terminal and Alacritty.

See my description/video documented here. https://github.com/sxyazi/yazi/issues/1557#issuecomment-2337029546

There are some solutions presented there as well. https://github.com/sxyazi/yazi/issues/1557#issuecomment-2340294607

To Reproduce

No response

Configuration

-- Pull in the wezterm API
local wezterm = require('wezterm')
local act = wezterm.action

-- This will hold the configuration.
local config = wezterm.config_builder()

-- This is where you actually apply your config choices
config.default_prog = { 'wsl', '--cd', '~' }
config.font = wezterm.font {
  -- Disable ligatures in most fonts
  family = 'JetBrains Mono',
  harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' },
}
config.font_size = 16
config.window_padding = { left = 5, right = 5, top = 0, bottom = 0 }
config.window_decorations = 'INTEGRATED_BUTTONS|RESIZE'
config.selection_word_boundary = ',│`|:"\' ()[]{}<>\t'
config.enable_scroll_bar = true
config.cursor_thickness = 2
config.audible_bell = 'Disabled'

-- For example, changing the color scheme:
config.color_scheme = 'Campbell (Gogh)'
config.color_schemes = {
  ['Campbell (Gogh)'] = {
    scrollbar_thumb = '9f9f9f',
  },
}

-- Mouse bindings
config.mouse_bindings = {
  -- Right-click to paste
  {
    event = { Down = { streak = 1, button = 'Right' } },
    mods = 'NONE',
    action = wezterm.action_callback(function(window, pane)
      local has_selection = window:get_selection_text_for_pane(pane) ~= ''
      if has_selection then
        window:perform_action(act.CopyTo('ClipboardAndPrimarySelection'), pane)
        window:perform_action(act.ClearSelection, pane)
      else
        window:perform_action(act({ PasteFrom = 'Clipboard' }), pane)
      end
    end),
  },

  -- Single Left Up: Focus window does not copy text
  {
    event = { Up = { streak = 1, button = 'Left' } },
    mods = 'NONE',
    action = act.Multiple({
      act.ClearSelection,
    }),
  },
  -- Single Left Drag to Highlight and Copy
  {
    event = { Drag = { streak = 1, button = 'Left' } },
    mods = 'NONE',
    action = act.Multiple({
      act.ExtendSelectionToMouseCursor("Cell"),
      act.CopyTo('ClipboardAndPrimarySelection'),
    }),
  },
  -- Double click to Copy
  {
    event = { Up = { streak = 2, button = 'Left' } },
    mods = 'NONE',
    action = act.Multiple({
      act.CopyTo('ClipboardAndPrimarySelection'),
      act.ClearSelection,
    }),
  },
  -- Triple click line to Copy
  {
    event = { Up = { streak = 3, button = 'Left' } },
    mods = 'NONE',
    action = act.Multiple({
      act.CopyTo('ClipboardAndPrimarySelection'),
      act.ClearSelection,
    }),
  },
  -- CTRL-Click to open hyperlink
  {
    event = { Up = { streak = 1, button = 'Left' } },
    mods = 'CTRL',
    action = act.OpenLinkAtMouseCursor,
  },
  -- NOTE that binding only the 'Up' event can give unexpected behaviors.
  -- Read more below on the gotcha of binding an 'Up' event only.

  -- Scrolling up while holding CTRL increases the font size
  {
    event = { Down = { streak = 1, button = { WheelUp = 1 } } },
    mods = 'CTRL',
    action = act.IncreaseFontSize,
  },
  -- Scrolling down while holding CTRL decreases the font size
  {
    event = { Down = { streak = 1, button = { WheelDown = 1 } } },
    mods = 'CTRL',
    action = act.DecreaseFontSize,
  },
}

-- Key bindings
config.keys = {
  -- Paste from the clipboard
  { key = 'v', mods = 'CTRL', action = act.PasteFrom 'Clipboard' },
  {
    key = "|",
    mods = 'CTRL|SHIFT',
    action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
  },
  {
    key = "_",
    mods = 'CTRL|SHIFT',
    action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
  },
}

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

Expected Behavior

No response

Logs

No response

Anything else?

No response

wez commented 2 months ago

Sounds like this will be resolved by updating to a newer version of conpty.dll once that comes out of preview

sxyazi commented 1 month ago

Maybe a duplicate of https://github.com/wez/wezterm/issues/4509