wez / wezterm

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

width of unicode chars affecting lines in tmux pane to the right #1908

Open mckellygit opened 2 years ago

mckellygit commented 2 years ago

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

Linux X11

WezTerm version

wezterm 20220421-183827-26500c67

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 create 2 tmux panes side-by-side and then I edit a unicode file with vim in the left side pane, the right side pane is no longer correct, with some lines shifted right some chars.

To Reproduce

create 2 tmux panes side by side, then in the left pane open unicode file with vim and notice right pane lines are moved some and no longer correct.

Configuration

local wezterm = require 'wezterm';
return {

  -- NOTE: if not set, default is term=xterm-256color,
  --       setting term=wezterm requires the termwiz/data/wezterm.terminfo to be compiled and installed ...
  -- set_environment_variables = {
  --   TERMINFO_DIRS='/home/user/.terminfo',
  --   WSLENV='TERMINFO_DIRS'
  -- },
  term = "wezterm",

  enable_wayland = false,

  audible_bell = "Disabled",

  visual_bell = {
    fade_in_duration_ms = 5,
    fade_out_duration_ms = 5,
    target = "CursorColor",
  },

  bold_brightens_ansi_colors = true,

  font = wezterm.font("JetBrains Mono"),
  -- if wayland then 16.0
  -- font_size = 16.0,
  font_size = 12.6,

  adjust_window_size_when_changing_font_size = false,

  initial_cols = 194,
  initial_rows = 51,
  line_height = 0.9,

  alternate_buffer_wheel_scroll_speed = 5,

  check_for_updates = false,

  window_background_opacity = 0.97,

  -- if bracketed-paste is not enabled/active, then -
  -- canonicalize_pasted_newlines = "CarriageReturnAndLineFeed",

  exit_behavior = "Close",
  window_close_confirmation = "AlwaysPrompt",

  swallow_mouse_click_on_pane_focus = true,
  swallow_mouse_click_on_window_focus = true,

  enable_tab_bar = false,
  hide_tab_bar_if_only_one_tab = true,

  scrollback_lines = 0,
  enable_scroll_bar = false,

  -- default_cursor_style = "SteadyBlock",
  default_cursor_style = "BlinkingBlock",
  cursor_blink_rate = 800,
  -- needed to prevent 'easing' from using 40%+ cpu util ...
  animation_fps = 1,

  -- max_fps = 60,

  -- color_scheme = "SpaceGray",

  colors = {
    foreground = "#c5c5c5",
    -- gray
    -- background = "#2e2e26",
    -- blue
    background = "#14292e",

    -- cursor_fg = "#111111",
    cursor_fg = "#ffffff",
    cursor_bg = "#d78700",
    cursor_border = "#d78700",

    selection_fg = "#000000",
    selection_bg = "#fffacd",

    -- ansi =    { "#000000", "#cc0403", "#19cb00", "#cecb00", "#5f87ff", "#ba55d3", "#0dcdcd", "#dddddd" },
    -- brights = { "#767676", "#f2201f", "#23fd00", "#fffd00", "#0066ff", "#875faf", "#14ffff", "#ffffff" },
    ansi =    { "#000000", "#b22222", "#008000", "#999900", "#0066ff", "#ba55d3", "#009999", "#dddddd" },
    brights = { "#808080", "#df0000", "#00d700", "#ffd700", "#5f87ff", "#875faf", "#00ffff", "#ffffff" },
  },

  bypass_mouse_reporting_modifiers = "SHIFT",
  disable_default_mouse_bindings = false,

  mouse_bindings = {
    {
      event={Up={streak=1, button="Left"}},
      mods="SHIFT",
      action="OpenLinkAtMouseCursor",
    },
  },

  enable_csi_u_key_encoding = false,

  use_dead_keys = false,
  disable_default_key_bindings = true,
  keys = {
    { key="phys:Backspace", mods="SHIFT",         action=wezterm.action{SendString="\x1e\x08"} },
    { key="phys:Space",     mods="SHIFT",         action=wezterm.action{SendString="\x1e\x20"} },
    { key="phys:Backspace", mods="CTRL",          action=wezterm.action{SendString="\x1e\x7f"} },

    { key="phys:Backspace", mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x7f"} },
    { key="phys:Space",     mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x20"} },
    { key="phys:Backspace", mods="ALT|SHIFT",     action="Nop"},
    { key="phys:Backspace", mods="ALT",           action="Nop"},
    -- these can launch window menu, disable
    { key="phys:Space",     mods="ALT|SHIFT",     action="Nop"},
    { key="phys:Space",     mods="ALT",           action="Nop"},

    -- { key="x",              mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1b\x78"} },

    { key="phys:Backspace", mods="CTRL|ALT",      action=wezterm.action{SendString="\x1b\x40"} },
    -- { key="=",              mods="CTRL|ALT",      action=wezterm.action{SendString="\x1b\x23"} },
    { key="phys:Equal",     mods="CTRL|ALT",      action=wezterm.action{SendString="\x1b\x23"} },
    { key="phys:Space",     mods="CTRL|ALT",      action=wezterm.action{SendString="\x1b\x23"} },
    -- { key="\\",             mods="CTRL|ALT",      action="Nop"},
    { key="\\",             mods="CTRL|ALT",      action="ActivateCopyMode" },

    { key="phys:Return",mods="CTRL|ALT",      action=wezterm.action{SendString="\x1e\x0d"} },

    { key="[",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x5b"} },
    { key="{",          mods="CTRL",          action=wezterm.action{SendString="\x1f\x5b"} },

    { key="[",          mods="CTRL|ALT",      action="Nop"},

    { key="]",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x5d"} },
    { key="}",          mods="CTRL",          action=wezterm.action{SendString="\x1f\x5d"} },

    { key="]",          mods="CTRL|ALT",      action="Nop"},

    { key="\\",         mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x5c"} },
    { key="|",          mods="CTRL",          action=wezterm.action{SendString="\x1f\x5c"} },

    { key="/",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x2f"} },
    { key="?",          mods="CTRL",          action=wezterm.action{SendString="\x1f\x2f"} },

    { key="f",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x06"} },
    { key="b",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x02"} },

    { key="j",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x4a"} },
    { key="k",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x4b"} },

    { key="g",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x47"} },
    { key="n",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x4e"} },
    { key="p",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x50"} },

    -- Super + v to send same as Alt + Ins ?
    { key="v",          mods="SUPER",         action=wezterm.action{SendString="\x1b[2;3~"} },

    -- { key="x",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1f\x58"} },
    -- old idea was to send M-( \x1b\x28, could also consider <C-_><C-x> \x1f\x18

    { key="Insert",     mods="CTRL",          action=wezterm.action{SendString="\x1b[2;5~"} },
    { key="Insert",     mods="SHIFT",         action=wezterm.action{SendString="\x1b[2;2~"} },
    -- { key="c",          mods="CTRL|SHIFT",    action="Copy" },
    -- { key="v",          mods="CTRL|SHIFT",    action="Paste" },
    -- { key="c",          mods="CTRL|SUPER",    action="Copy" },
    -- { key="v",          mods="CTRL|SUPER",    action="Paste" },
    { key="c",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1b[2;5~"} },
    { key="v",          mods="CTRL|SHIFT",    action=wezterm.action{SendString="\x1b[2;2~"} },
    { key="c",          mods="CTRL|ALT",      action="Copy" },
    { key="v",          mods="CTRL|ALT",      action="Paste" },

    { key="phys:Minus", mods="CTRL",          action=wezterm.action{SendString="\x1e\x2d"} },

    -- { key="+",          mods="CTRL",          action="IncreaseFontSize" },
    -- { key="_",          mods="CTRL",          action="DecreaseFontSize" },
    -- { key=")",          mods="CTRL",          action="ResetFontSize" },
    { key="phys:Equal", mods="CTRL|SHIFT",    action="IncreaseFontSize" },
    { key="phys:Minus", mods="CTRL|SHIFT",    action="DecreaseFontSize" },
    { key="phys:0",     mods="CTRL|SHIFT",    action="ResetFontSize" },
  }
}

Expected Behavior

other terminals (kitty, alacritty, st) do not seem to have this issue.

Logs

10:42:09.787  INFO   wezterm_gui::termwindow > OpenGL initialized! Mesa Intel(R) HD Graphics 530 (SKL GT2) 4.6 (Compatibility Profile) Mesa 21.2.6 is_context_loss_possible=false wezterm version: 20220421-183827-26500c67
10:42:35.322  WARN   wezterm_term::terminalstate > unhandled DecPrivateMode ResetDecPrivateMode(Unspecified(1005))
10:42:35.326  WARN   wezterm_term::terminalstate > unhandled DecPrivateMode SetDecPrivateMode(Unspecified(7727))
10:42:35.326  WARN   wezterm_term::terminalstate > unhandled DecPrivateMode SetDecPrivateMode(Unspecified(7727))
10:43:17.012  WARN   wezterm_term::terminalstate > unhandled DecPrivateMode ResetDecPrivateMode(Unspecified(1005))
10:43:17.012  WARN   wezterm_term::terminalstate > unhandled DecPrivateMode ResetDecPrivateMode(Unspecified(7727))

Anything else?

Thank you for wezterm, it is awesome. A line to put into a file for testing ? Comment[hi]=काटें एवं चिपकाएं इतिहास यूटिलिटी

wez commented 2 years ago

Please capture a terminal recording:

*** Finished recording to /var/tmp/wezterm-recording-sF6B3u.cast.txt

The file is an asciicast (compatible with https://asciinema.org/) and can also be replayed using wezterm replay.

The terminal recording allows me to replicate what is being sent to the terminal without requiring me to install the same applications as you and replicate your configuration for everything.

mckellygit commented 2 years ago

wezterm-recording-cFYGmn.cast.txt

mckellygit commented 2 years ago

u3.txt