Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key repeat gets stuck after pressing two keys in fast succession (again) #4061

Open
wookayin opened this issue Jul 27, 2023 · 5 comments
Open
Labels
bug Something isn't working keyboard Keyboard mapping/handling macOS Issue applies to Apple macOS

Comments

@wookayin
Copy link

wookayin commented Jul 27, 2023

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

macOS

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

macOS. No window manager used.

WezTerm version

wezterm 20230712-072601-f4abf8fd

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

Same in the nightly wezterm 20230726-161042.

I think the same bug as in #2452 happens again on my environments. The key repeat is stuck when pressing two keys (for a sufficient long time to repeat) in quick succession results in the second key printing one character.

It was working OK in some of the previous version.

e.g.

Actual:

aaaaaaaaaaaaaaabaaaaaaaaaab

To Reproduce

Same as in #2452; Go into a terminal. Press the key A on your keyboard and hold it. Release it and quickly press the letter B on the keyboard and hold it. b is only printed once, even though it should be continuously be printed.

Configuration

No config needed. Reproducible with the default (zero) config.

Expected Behavior

Expected:

aaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbaaaaaaaaaaaabbbbbbbbbbbb

Logs

No response

Anything else?

demo

@wookayin wookayin added the bug Something isn't working label Jul 27, 2023
@wez
Copy link
Owner

wez commented Jul 27, 2023

Please include the debug key events logs from https://wezfurlong.org/wezterm/troubleshooting.html#debugging-keyboard-related-issues

@wez wez added the waiting-on-op Waiting for more information from the original poster label Jul 27, 2023
@wookayin
Copy link
Author

wookayin commented Jul 27, 2023

$ wezterm show-keys --lua
local wezterm = require 'wezterm'
local act = wezterm.action

return {
  keys = {
    { key = 'Tab', mods = 'CTRL', action = act.ActivateTabRelative(1) },
    { key = 'Tab', mods = 'SHIFT|CTRL', action = act.ActivateTabRelative(-1) },
    { key = 'Enter', mods = 'ALT', action = act.ToggleFullScreen },
    { key = '!', mods = 'CTRL', action = act.ActivateTab(0) },
    { key = '!', mods = 'SHIFT|CTRL', action = act.ActivateTab(0) },
    { key = '\"', mods = 'ALT|CTRL', action = act.SplitVertical{ domain =  'CurrentPaneDomain' } },
    { key = '\"', mods = 'SHIFT|ALT|CTRL', action = act.SplitVertical{ domain =  'CurrentPaneDomain' } },
    { key = '#', mods = 'CTRL', action = act.ActivateTab(2) },
    { key = '#', mods = 'SHIFT|CTRL', action = act.ActivateTab(2) },
    { key = '$', mods = 'CTRL', action = act.ActivateTab(3) },
    { key = '$', mods = 'SHIFT|CTRL', action = act.ActivateTab(3) },
    { key = '%', mods = 'CTRL', action = act.ActivateTab(4) },
    { key = '%', mods = 'SHIFT|CTRL', action = act.ActivateTab(4) },
    { key = '%', mods = 'ALT|CTRL', action = act.SplitHorizontal{ domain =  'CurrentPaneDomain' } },
    { key = '%', mods = 'SHIFT|ALT|CTRL', action = act.SplitHorizontal{ domain =  'CurrentPaneDomain' } },
    { key = '&', mods = 'CTRL', action = act.ActivateTab(6) },
    { key = '&', mods = 'SHIFT|CTRL', action = act.ActivateTab(6) },
    { key = '\'', mods = 'SHIFT|ALT|CTRL', action = act.SplitVertical{ domain =  'CurrentPaneDomain' } },
    { key = '(', mods = 'CTRL', action = act.ActivateTab(-1) },
    { key = '(', mods = 'SHIFT|CTRL', action = act.ActivateTab(-1) },
    { key = ')', mods = 'CTRL', action = act.ResetFontSize },
    { key = ')', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
    { key = '*', mods = 'CTRL', action = act.ActivateTab(7) },
    { key = '*', mods = 'SHIFT|CTRL', action = act.ActivateTab(7) },
    { key = '+', mods = 'CTRL', action = act.IncreaseFontSize },
    { key = '+', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
    { key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
    { key = '-', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },
    { key = '-', mods = 'SUPER', action = act.DecreaseFontSize },
    { key = '0', mods = 'CTRL', action = act.ResetFontSize },
    { key = '0', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
    { key = '0', mods = 'SUPER', action = act.ResetFontSize },
    { key = '1', mods = 'SHIFT|CTRL', action = act.ActivateTab(0) },
    { key = '1', mods = 'SUPER', action = act.ActivateTab(0) },
    { key = '2', mods = 'SHIFT|CTRL', action = act.ActivateTab(1) },
    { key = '2', mods = 'SUPER', action = act.ActivateTab(1) },
    { key = '3', mods = 'SHIFT|CTRL', action = act.ActivateTab(2) },
    { key = '3', mods = 'SUPER', action = act.ActivateTab(2) },
    { key = '4', mods = 'SHIFT|CTRL', action = act.ActivateTab(3) },
    { key = '4', mods = 'SUPER', action = act.ActivateTab(3) },
    { key = '5', mods = 'SHIFT|CTRL', action = act.ActivateTab(4) },
    { key = '5', mods = 'SHIFT|ALT|CTRL', action = act.SplitHorizontal{ domain =  'CurrentPaneDomain' } },
    { key = '5', mods = 'SUPER', action = act.ActivateTab(4) },
    { key = '6', mods = 'SHIFT|CTRL', action = act.ActivateTab(5) },
    { key = '6', mods = 'SUPER', action = act.ActivateTab(5) },
    { key = '7', mods = 'SHIFT|CTRL', action = act.ActivateTab(6) },
    { key = '7', mods = 'SUPER', action = act.ActivateTab(6) },
    { key = '8', mods = 'SHIFT|CTRL', action = act.ActivateTab(7) },
    { key = '8', mods = 'SUPER', action = act.ActivateTab(7) },
    { key = '9', mods = 'SHIFT|CTRL', action = act.ActivateTab(-1) },
    { key = '9', mods = 'SUPER', action = act.ActivateTab(-1) },
    { key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
    { key = '=', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
    { key = '=', mods = 'SUPER', action = act.IncreaseFontSize },
    { key = '@', mods = 'CTRL', action = act.ActivateTab(1) },
    { key = '@', mods = 'SHIFT|CTRL', action = act.ActivateTab(1) },
    { key = 'C', mods = 'CTRL', action = act.CopyTo 'Clipboard' },
    { key = 'C', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
    { key = 'F', mods = 'CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
    { key = 'F', mods = 'SHIFT|CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
    { key = 'H', mods = 'CTRL', action = act.HideApplication },
    { key = 'H', mods = 'SHIFT|CTRL', action = act.HideApplication },
    { key = 'K', mods = 'CTRL', action = act.ClearScrollback 'ScrollbackOnly' },
    { key = 'K', mods = 'SHIFT|CTRL', action = act.ClearScrollback 'ScrollbackOnly' },
    { key = 'L', mods = 'CTRL', action = act.ShowDebugOverlay },
    { key = 'L', mods = 'SHIFT|CTRL', action = act.ShowDebugOverlay },
    { key = 'M', mods = 'CTRL', action = act.Hide },
    { key = 'M', mods = 'SHIFT|CTRL', action = act.Hide },
    { key = 'N', mods = 'CTRL', action = act.SpawnWindow },
    { key = 'N', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
    { key = 'P', mods = 'CTRL', action = act.ActivateCommandPalette },
    { key = 'P', mods = 'SHIFT|CTRL', action = act.ActivateCommandPalette },
    { key = 'Q', mods = 'CTRL', action = act.QuitApplication },
    { key = 'Q', mods = 'SHIFT|CTRL', action = act.QuitApplication },
    { key = 'R', mods = 'CTRL', action = act.ReloadConfiguration },
    { key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
    { key = 'T', mods = 'CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
    { key = 'T', mods = 'SHIFT|CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
    { key = 'U', mods = 'CTRL', action = act.CharSelect{ copy_on_select = true, copy_to =  'ClipboardAndPrimarySelection' } },
    { key = 'U', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to =  'ClipboardAndPrimarySelection' } },
    { key = 'V', mods = 'CTRL', action = act.PasteFrom 'Clipboard' },
    { key = 'V', mods = 'SHIFT|CTRL', action = act.PasteFrom 'Clipboard' },
    { key = 'W', mods = 'CTRL', action = act.CloseCurrentTab{ confirm = true } },
    { key = 'W', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab{ confirm = true } },
    { key = 'X', mods = 'CTRL', action = act.ActivateCopyMode },
    { key = 'X', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
    { key = 'Z', mods = 'CTRL', action = act.TogglePaneZoomState },
    { key = 'Z', mods = 'SHIFT|CTRL', action = act.TogglePaneZoomState },
    { key = '[', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(-1) },
    { key = ']', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(1) },
    { key = '^', mods = 'CTRL', action = act.ActivateTab(5) },
    { key = '^', mods = 'SHIFT|CTRL', action = act.ActivateTab(5) },
    { key = '_', mods = 'CTRL', action = act.DecreaseFontSize },
    { key = '_', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },
    { key = 'c', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
    { key = 'c', mods = 'SUPER', action = act.CopyTo 'Clipboard' },
    { key = 'f', mods = 'SHIFT|CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
    { key = 'f', mods = 'SUPER', action = act.Search 'CurrentSelectionOrEmptyString' },
    { key = 'h', mods = 'SHIFT|CTRL', action = act.HideApplication },
    { key = 'h', mods = 'SUPER', action = act.HideApplication },
    { key = 'k', mods = 'SHIFT|CTRL', action = act.ClearScrollback 'ScrollbackOnly' },
    { key = 'k', mods = 'SUPER', action = act.ClearScrollback 'ScrollbackOnly' },
    { key = 'l', mods = 'SHIFT|CTRL', action = act.ShowDebugOverlay },
    { key = 'm', mods = 'SHIFT|CTRL', action = act.Hide },
    { key = 'm', mods = 'SUPER', action = act.Hide },
    { key = 'n', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
    { key = 'n', mods = 'SUPER', action = act.SpawnWindow },
    { key = 'p', mods = 'SHIFT|CTRL', action = act.ActivateCommandPalette },
    { key = 'q', mods = 'SHIFT|CTRL', action = act.QuitApplication },
    { key = 'q', mods = 'SUPER', action = act.QuitApplication },
    { key = 'r', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
    { key = 'r', mods = 'SUPER', action = act.ReloadConfiguration },
    { key = 't', mods = 'SHIFT|CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
    { key = 't', mods = 'SUPER', action = act.SpawnTab 'CurrentPaneDomain' },
    { key = 'u', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to =  'ClipboardAndPrimarySelection' } },
    { key = 'v', mods = 'SHIFT|CTRL', action = act.PasteFrom 'Clipboard' },
    { key = 'v', mods = 'SUPER', action = act.PasteFrom 'Clipboard' },
    { key = 'w', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab{ confirm = true } },
    { key = 'w', mods = 'SUPER', action = act.CloseCurrentTab{ confirm = true } },
    { key = 'x', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
    { key = 'z', mods = 'SHIFT|CTRL', action = act.TogglePaneZoomState },
    { key = '{', mods = 'SUPER', action = act.ActivateTabRelative(-1) },
    { key = '{', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(-1) },
    { key = '}', mods = 'SUPER', action = act.ActivateTabRelative(1) },
    { key = '}', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(1) },
    { key = 'phys:Space', mods = 'SHIFT|CTRL', action = act.QuickSelect },
    { key = 'PageUp', mods = 'SHIFT', action = act.ScrollByPage(-1) },
    { key = 'PageUp', mods = 'CTRL', action = act.ActivateTabRelative(-1) },
    { key = 'PageUp', mods = 'SHIFT|CTRL', action = act.MoveTabRelative(-1) },
    { key = 'PageDown', mods = 'SHIFT', action = act.ScrollByPage(1) },
    { key = 'PageDown', mods = 'CTRL', action = act.ActivateTabRelative(1) },
    { key = 'PageDown', mods = 'SHIFT|CTRL', action = act.MoveTabRelative(1) },
    { key = 'LeftArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Left' },
    { key = 'LeftArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Left', 1 } },
    { key = 'RightArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Right' },
    { key = 'RightArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Right', 1 } },
    { key = 'UpArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Up' },
    { key = 'UpArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Up', 1 } },
    { key = 'DownArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Down' },
    { key = 'DownArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Down', 1 } },
    { key = 'Copy', mods = 'NONE', action = act.CopyTo 'Clipboard' },
    { key = 'Paste', mods = 'NONE', action = act.PasteFrom 'Clipboard' },
  },

  key_tables = {
    copy_mode = {
      { key = 'Tab', mods = 'NONE', action = act.CopyMode 'MoveForwardWord' },
      { key = 'Tab', mods = 'SHIFT', action = act.CopyMode 'MoveBackwardWord' },
      { key = 'Enter', mods = 'NONE', action = act.CopyMode 'MoveToStartOfNextLine' },
      { key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
      { key = 'Space', mods = 'NONE', action = act.CopyMode{ SetSelectionMode =  'Cell' } },
      { key = '$', mods = 'NONE', action = act.CopyMode 'MoveToEndOfLineContent' },
      { key = '$', mods = 'SHIFT', action = act.CopyMode 'MoveToEndOfLineContent' },
      { key = ',', mods = 'NONE', action = act.CopyMode 'JumpReverse' },
      { key = '0', mods = 'NONE', action = act.CopyMode 'MoveToStartOfLine' },
      { key = ';', mods = 'NONE', action = act.CopyMode 'JumpAgain' },
      { key = 'F', mods = 'NONE', action = act.CopyMode{ JumpBackward = { prev_char = false } } },
      { key = 'F', mods = 'SHIFT', action = act.CopyMode{ JumpBackward = { prev_char = false } } },
      { key = 'G', mods = 'NONE', action = act.CopyMode 'MoveToScrollbackBottom' },
      { key = 'G', mods = 'SHIFT', action = act.CopyMode 'MoveToScrollbackBottom' },
      { key = 'H', mods = 'NONE', action = act.CopyMode 'MoveToViewportTop' },
      { key = 'H', mods = 'SHIFT', action = act.CopyMode 'MoveToViewportTop' },
      { key = 'L', mods = 'NONE', action = act.CopyMode 'MoveToViewportBottom' },
      { key = 'L', mods = 'SHIFT', action = act.CopyMode 'MoveToViewportBottom' },
      { key = 'M', mods = 'NONE', action = act.CopyMode 'MoveToViewportMiddle' },
      { key = 'M', mods = 'SHIFT', action = act.CopyMode 'MoveToViewportMiddle' },
      { key = 'O', mods = 'NONE', action = act.CopyMode 'MoveToSelectionOtherEndHoriz' },
      { key = 'O', mods = 'SHIFT', action = act.CopyMode 'MoveToSelectionOtherEndHoriz' },
      { key = 'T', mods = 'NONE', action = act.CopyMode{ JumpBackward = { prev_char = true } } },
      { key = 'T', mods = 'SHIFT', action = act.CopyMode{ JumpBackward = { prev_char = true } } },
      { key = 'V', mods = 'NONE', action = act.CopyMode{ SetSelectionMode =  'Line' } },
      { key = 'V', mods = 'SHIFT', action = act.CopyMode{ SetSelectionMode =  'Line' } },
      { key = '^', mods = 'NONE', action = act.CopyMode 'MoveToStartOfLineContent' },
      { key = '^', mods = 'SHIFT', action = act.CopyMode 'MoveToStartOfLineContent' },
      { key = 'b', mods = 'NONE', action = act.CopyMode 'MoveBackwardWord' },
      { key = 'b', mods = 'ALT', action = act.CopyMode 'MoveBackwardWord' },
      { key = 'b', mods = 'CTRL', action = act.CopyMode 'PageUp' },
      { key = 'c', mods = 'CTRL', action = act.CopyMode 'Close' },
      { key = 'd', mods = 'CTRL', action = act.CopyMode{ MoveByPage = (0.5) } },
      { key = 'e', mods = 'NONE', action = act.CopyMode 'MoveForwardWordEnd' },
      { key = 'f', mods = 'NONE', action = act.CopyMode{ JumpForward = { prev_char = false } } },
      { key = 'f', mods = 'ALT', action = act.CopyMode 'MoveForwardWord' },
      { key = 'f', mods = 'CTRL', action = act.CopyMode 'PageDown' },
      { key = 'g', mods = 'NONE', action = act.CopyMode 'MoveToScrollbackTop' },
      { key = 'g', mods = 'CTRL', action = act.CopyMode 'Close' },
      { key = 'h', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
      { key = 'j', mods = 'NONE', action = act.CopyMode 'MoveDown' },
      { key = 'k', mods = 'NONE', action = act.CopyMode 'MoveUp' },
      { key = 'l', mods = 'NONE', action = act.CopyMode 'MoveRight' },
      { key = 'm', mods = 'ALT', action = act.CopyMode 'MoveToStartOfLineContent' },
      { key = 'o', mods = 'NONE', action = act.CopyMode 'MoveToSelectionOtherEnd' },
      { key = 'q', mods = 'NONE', action = act.CopyMode 'Close' },
      { key = 't', mods = 'NONE', action = act.CopyMode{ JumpForward = { prev_char = true } } },
      { key = 'u', mods = 'CTRL', action = act.CopyMode{ MoveByPage = (-0.5) } },
      { key = 'v', mods = 'NONE', action = act.CopyMode{ SetSelectionMode =  'Cell' } },
      { key = 'v', mods = 'CTRL', action = act.CopyMode{ SetSelectionMode =  'Block' } },
      { key = 'w', mods = 'NONE', action = act.CopyMode 'MoveForwardWord' },
      { key = 'y', mods = 'NONE', action = act.Multiple{ { CopyTo =  'ClipboardAndPrimarySelection' }, { CopyMode =  'Close' } } },
      { key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PageUp' },
      { key = 'PageDown', mods = 'NONE', action = act.CopyMode 'PageDown' },
      { key = 'End', mods = 'NONE', action = act.CopyMode 'MoveToEndOfLineContent' },
      { key = 'Home', mods = 'NONE', action = act.CopyMode 'MoveToStartOfLine' },
      { key = 'LeftArrow', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
      { key = 'LeftArrow', mods = 'ALT', action = act.CopyMode 'MoveBackwardWord' },
      { key = 'RightArrow', mods = 'NONE', action = act.CopyMode 'MoveRight' },
      { key = 'RightArrow', mods = 'ALT', action = act.CopyMode 'MoveForwardWord' },
      { key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'MoveUp' },
      { key = 'DownArrow', mods = 'NONE', action = act.CopyMode 'MoveDown' },
    },

    search_mode = {
      { key = 'Enter', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
      { key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
      { key = 'n', mods = 'CTRL', action = act.CopyMode 'NextMatch' },
      { key = 'p', mods = 'CTRL', action = act.CopyMode 'PriorMatch' },
      { key = 'r', mods = 'CTRL', action = act.CopyMode 'CycleMatchType' },
      { key = 'u', mods = 'CTRL', action = act.CopyMode 'ClearPattern' },
      { key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PriorMatchPage' },
      { key = 'PageDown', mods = 'NONE', action = act.CopyMode 'NextMatchPage' },
      { key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
      { key = 'DownArrow', mods = 'NONE', action = act.CopyMode 'NextMatch' },
    },

  }
}
Key logs
16:42:39.246  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:39.247  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: None }
16:42:39.247  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('a') mods=NONE
16:42:39.247  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "a", Char('a') NONE
16:42:39.582  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:39.584  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: None }
16:42:39.584  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('a') mods=NONE
16:42:39.584  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "a", Char('a') NONE
16:42:39.598  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:39.603  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: None }
16:42:39.603  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('a') mods=NONE
16:42:39.603  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "a", Char('a') NONE
16:42:39.622  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:39.624  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: None }
16:42:39.624  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('a') mods=NONE
16:42:39.624  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "a", Char('a') NONE
16:42:39.636  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:39.637  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: None }
16:42:39.638  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('a') mods=NONE
16:42:39.638  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "a", Char('a') NONE
16:42:39.651  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:39.653  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: None }
16:42:39.653  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('a') mods=NONE
16:42:39.653  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "a", Char('a') NONE
16:42:39.665  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:39.667  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: None }
16:42:39.667  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('a') mods=NONE
16:42:39.667  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "a", Char('a') NONE
16:42:39.684  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:39.686  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: None }
16:42:39.686  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('a') mods=NONE
16:42:39.686  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "a", Char('a') NONE
16:42:39.687  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:39.687  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: true, raw: None }
16:42:39.687  INFO   wezterm_gui::termwindow::keyevent     > send to pane DOWN key=Char('b') mods=NONE
16:42:39.687  INFO   wezterm_term::terminalstate::keyboard > key_down: sending "b", Char('b') NONE
16:42:39.707  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: false, handled: Handled(false) }
16:42:39.707  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Char('a'), modifiers: NONE, leds: (empty), phys_code: Some(A), raw_code: 0, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
16:42:39.707  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('a') mods=NONE
16:42:40.021  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.040  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.055  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.071  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.088  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.107  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.124  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.139  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.156  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.173  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.190  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.208  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.224  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.241  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.258  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.274  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: true, handled: Handled(false) }
16:42:40.290  INFO   wezterm_gui::termwindow::keyevent     > key_event RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: false, handled: Handled(false) }
16:42:40.290  INFO   wezterm_gui::termwindow::keyevent     > key_event KeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Char('b'), modifiers: NONE, leds: (empty), phys_code: Some(B), raw_code: 11, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
16:42:40.290  INFO   wezterm_gui::termwindow::keyevent     > send to pane UP key=Char('b') mods=NONE

This happened when a type aaaaaaabbbbbb (resulted in aaaaaaab). I can se a bunch of b keydown events which were not prosessed --- the first keydown of b happened before the keyup event of a.

@github-actions github-actions bot removed the waiting-on-op Waiting for more information from the original poster label Jul 27, 2023
@wookayin
Copy link
Author

wookayin commented Jul 28, 2023

I think this is a bug in the key event implementation for macos; it seems that it has something to do with macOS IME.

Setting config.use_ime = false following a suggestion in #215 (comment) resolves the issue -- but this should be as only a workaround. But disabling IME kills non-English inputs (e.g. CJK with multi-byte unicode characters...)

This option appears to be enabled by default since 20220319, but this still causes a problem in key repeat as of now (macOS Ventura 13 and wezterm nightly).

@wez wez added macOS Issue applies to Apple macOS keyboard Keyboard mapping/handling labels Aug 6, 2023
@wookayin
Copy link
Author

On macOS, with config.use_ime = true --- the default value, and a recommended setting so that multi-byte, non-English input (e.g. 한글, 日本語, 中文) can work properly --- users will need the following setting:

# Use key repeat instead of the accents menu when holding a key
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false

(See https://macos-defaults.com/misc/applepressandholdenabled.html for more information about the option)

Alternatively, if one doesn't wish this option enabled globally, one can also do per-app config such as:

defaults write com.github.wez.wezterm ApplePressAndHoldEnabled -bool false

This would be only a workaroun; hope that in the future we could have a proper fix for the broken successive key repeats, because many other apps would work OK even without this setting.

wookayin added a commit to wookayin/dotfiles that referenced this issue Sep 12, 2023
With the ApplePressAndHoldEnabled macOS option disabled globally,
the IME-based key input mechanism for wezterm can work without any
problems including successive key repeats and inputting Korean letters.

Ref: wez/wezterm#4061
@psyclaudeZ
Copy link

psyclaudeZ commented Sep 29, 2024

I press j and k constantly as a fidget spinner in Vim so this issue is noticeable (and kinda disruptive) to me. Might be a fix: #6388 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working keyboard Keyboard mapping/handling macOS Issue applies to Apple macOS
Projects
None yet
Development

No branches or pull requests

3 participants