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

Keybindings not respected in CommandPalette #3470

Closed
icecreammatt opened this issue Apr 8, 2023 · 10 comments
Closed

Keybindings not respected in CommandPalette #3470

icecreammatt opened this issue Apr 8, 2023 · 10 comments
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. keyboard Keyboard mapping/handling

Comments

@icecreammatt
Copy link
Sponsor

icecreammatt commented Apr 8, 2023

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

macOS

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

No response

WezTerm version

wezterm 20230324-233449-d60cdbf7

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 use Colemak keybindings and noticed that when using the CommandPalette that it only responds to QWERTY despite working everywhere else. I thought this was initially working but noticed that war no longer the case now. I tried on the last non nightly release (WezTerm-macos-20230326-111934-3666303c) and with the nightly (WezTerm-macos-20230408-112425-69ae8472) I swear this was working before but maybe it never was?

To Reproduce

Set MacOS keyboard layout to Colemak:

  • System Preferences
  • Input Sources
  • Add Colemak
  • Invoke command menu in Wezterm and type arst (COLEMAK home row) and you will see asdf (QWERTY home row)

I suspect somewhere it is maybe reading the raw keyboard codes instead of using whatever layer OSX applies on top.

Update: I was able to track down that it was working properly in this release here: WezTerm-macos-20230325-134754-1c55ca14

Commit causing issue:

I've tracked down the d491c73 causing the issue here: #3470 (comment)

Configuration

Click to expand
local wezterm = require 'wezterm'
local act = wezterm.action

return {
   adjust_window_size_when_changing_font_size = false,
   font_size = 18.0,
   hide_tab_bar_if_only_one_tab = true,
   window_decorations = "RESIZE",
   color_scheme = 'nord',
   scrollback_lines = 10000,

   check_for_updates_interval_seconds = 1209600,

   use_fancy_tab_bar = false,

  --  tab_bar_style = {
  --   active_tab_left = wezterm.format {
  --     { Background = { Color = '#0b0022' } },
  --     { Foreground = { Color = '#2b2042' } },
  --   },
  --   active_tab_right = wezterm.format {
  --     { Background = { Color = '#0b0022' } },
  --     { Foreground = { Color = '#2b2042' } },
  --   },
  --   inactive_tab_left = wezterm.format {
  --     { Background = { Color = '#0b0022' } },
  --     { Foreground = { Color = '#1b1032' } },
  --   },
  --   inactive_tab_right = wezterm.format {
  --     { Background = { Color = '#0b0022' } },
  --     { Foreground = { Color = '#1b1032' } },
  --   },
  -- },


  -- timeout_milliseconds defaults to 1000 and can be omitted
  leader = { key = ',', mods = 'CTRL', timeout_milliseconds = 1000 },

  keys = {
    { key="l", mods="LEADER", action=wezterm.action{QuickSelectArgs={
            patterns={
              "http?://\\S+",
              "https?://\\S+",
              "localhost:[0-9]+",
              "localhost",
            },
            action = wezterm.action_callback(function(window, pane)
               local url = window:get_selection_text_for_pane(pane)
               local pattern = "local"
               if url:find(pattern) then
                  if string.find(url, "http") == false then
                    url = string.format("http://%s", url)
                  end
               end
              wezterm.open_with(url)
            end)
          } }
    },
    { key = 's', mods = 'LEADER', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }, },
    { key = 'v', mods = 'LEADER', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }, },
    { key = "Space", mods = "LEADER", action = wezterm.action.ShowLauncher },
    { key = 's', mods = 'SHIFT|SUPER', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }, },
    { key = 'v', mods = 'SHIFT|SUPER', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }, },
    { key = '{', mods = 'SHIFT|ALT', action = act.MoveTabRelative(-1) },
    { key = '}', mods = 'SHIFT|ALT', action = act.MoveTabRelative(1) },
    { 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 = 'SUPER', 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 = 'CTRL', action = act.IncreaseFontSize },
    { key = '=', mods = 'SHIFT|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 = 'SUPER', action = act.SpawnWindow },
    -- { key = 'N', mods = 'SHIFT|SUPER', action = act.SpawnWindow },
    -- { 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 = 'F12', mods = 'NONE', action = act.TogglePaneZoomState },
    { key = 'z', mods = 'LEADER', action = act.TogglePaneZoomState },
    { key = 'f', mods = 'LEADER', action = act.TogglePaneZoomState },
    { key = 'f', mods = 'SHIFT|SUPER', action = act.TogglePaneZoomState },
    { key = 'x', mods = 'LEADER', 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 = '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 = 'c', mods = 'LEADER', action = act.QuickSelect },
    { key = 'PageUp', mods = 'SHIFT', action = act.ScrollByPage(-1) },
    { key = 'U', mods = 'SHIFT|CTRL', 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 = 'E', mods = 'SHIFT|CTRL', 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 = 'LeftArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Left', 1 } },
    { key = 'RightArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Right', 1 } },
    { key = 'UpArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Up', 1 } },
    { key = 'DownArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Down', 1 } },

    { key = 'LeftArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Left', 1 } },
    { key = 'RightArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Right', 1 } },
    { key = 'UpArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Up', 1 } },
    { key = 'DownArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize{ 'Down', 1 } },
    { key = 'n', mods = 'SHIFT|ALT', action = act.AdjustPaneSize{ 'Left', 1 } },
    { key = 'i', mods = 'SHIFT|ALT', action = act.AdjustPaneSize{ 'Right', 1 } },
    { key = 'u', mods = 'SHIFT|ALT', action = act.AdjustPaneSize{ 'Up', 1 } },
    { key = 'e', mods = 'SHIFT|ALT', action = act.AdjustPaneSize{ 'Down', 1 } },
    { key = 'n', mods = 'ALT', action = act.ActivatePaneDirection 'Left' },
    { key = 'i', mods = 'ALT', action = act.ActivatePaneDirection 'Right' },
    { key = 'u', mods = 'ALT', action = act.ActivatePaneDirection 'Up' },
    { key = 'e', mods = 'ALT', action = act.ActivatePaneDirection 'Down' },

    { 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 = 'x', mods = 'NONE', 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 = 'j', 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 = 'n', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
      { key = 'e', mods = 'NONE', action = act.CopyMode 'MoveDown' },
      { key = 'u', mods = 'NONE', action = act.CopyMode 'MoveUp' },
      { key = 'i', 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 = 'l', 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 = '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 = 'l', 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' },
      },
    },

    hyperlink_rules = {
      -- Linkify things that look like URLs and the host has a TLD name.
      -- Compiled-in default. Used if you don't specify any hyperlink_rules.
      {
        regex = '\\b\\w+://[\\w.-]+\\.[a-z]{2,15}\\S*\\b',
        format = '$0',
      },

      -- linkify email addresses
      -- Compiled-in default. Used if you don't specify any hyperlink_rules.
      -- {
      --   regex = [[\b\w+@[\w-]+(\.[\w-]+)+\b]],
      --   format = 'mailto:$0',
      -- },

      -- file:// URI
      -- Compiled-in default. Used if you don't specify any hyperlink_rules.
      -- {
      --   regex = [[\bfile://\S*\b]],
      --   format = '$0',
      -- },

      -- Linkify things that look like URLs with numeric addresses as hosts.
      -- E.g. http://127.0.0.1:8000 for a local development server,
      -- or http://192.168.1.1 for the web interface of many routers.
      {
        regex = [[\b\w+://(?:[\d]{1,3}\.){3}[\d]{1,3}\S*\b]],
        format = '$0',
      },

      -- Make localhost links clickable
      -- Orders seems to matter here so check for localhost without
      -- http first since in the second scenario since wezterm wont
      -- open a url without a prefix
      {
        regex = [[(localhost)+(:?[0-9]{1,9})?]],
        format = 'http://$1$2',
      },
      {
        regex = [[(http+s?://)?(localhost)+(:?[0-9]{1,9})?]],
        format = '$1$2$3',
      },

      -- Make task numbers clickable
      -- The first matched regex group is captured in $1.
      -- {
      --   regex = [[\b[tT](\d+)\b]],
      --   format = 'https://example.com/tasks/?t=$1',
      -- },

      -- Make username/project paths clickable. This implies paths like the following are for GitHub.
      -- ( "nvim-treesitter/nvim-treesitter" | wbthomason/packer.nvim | wez/wezterm | "wez/wezterm.git" )
      -- As long as a full URL hyperlink regex exists above this it should not match a full URL to
      -- GitHub or GitLab / BitBucket (i.e. https://gitlab.com/user/project.git is still a whole clickable URL)
      -- {
      --   regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]],
      --   format = 'https://www.github.com/$1/$3',
      -- },
    },

}

Expected Behavior

When invoking the CommandPalette with an alternate keyboard layout (Colemak) it should show the correct keys typed.

Logs

No response

Anything else?

No response

@icecreammatt icecreammatt added the bug Something isn't working label Apr 8, 2023
@icecreammatt icecreammatt changed the title Keybindings not respected in command menu Keybindings not respected in CommandPalette Apr 8, 2023
@icecreammatt icecreammatt changed the title Keybindings not respected in CommandPalette (MacOS) Keybindings not respected in CommandPalette Apr 8, 2023
@icecreammatt
Copy link
Sponsor Author

icecreammatt commented Apr 8, 2023

This commit here: 500934b appears to be the last working one before the issue arises.

I did some bisecting and landed on this commit here where it breaks:

git bisect good
d491c736ef6e320004e62270ec18036e698ffac7 is the first bad commit
commit d491c736ef6e320004e62270ec18036e698ffac7
Author: Wez Furlong <wez@wezfurlong.org>
Date:   Sat Mar 25 18:24:26 2023 -0700

    When a modal is active, it gets first dibs on key processing

    This fixes a surprising interaction between copy mode and the
    command palette, but is also the root cause of another issue
    with CharSelect mode.

    refs: https://github.com/wez/wezterm/issues/2947

 docs/changelog.md                        |  3 +++
 wezterm-gui/src/termwindow/charselect.rs | 12 ++++++------
 wezterm-gui/src/termwindow/keyevent.rs   | 21 ++++++++++++++-------
 wezterm-gui/src/termwindow/modal.rs      |  2 +-
 wezterm-gui/src/termwindow/palette.rs    | 12 ++++++------
 wezterm-gui/src/termwindow/paneselect.rs |  9 +++++----
 6 files changed, 35 insertions(+), 24 deletions(-)

git bisect log
git bisect start
# status: waiting for both good and bad commits
# good: [1c55ca14b0e11848b5c0cd0d31ed21b61d06eca9] macos: invalidate window when dispatching from menubar
git bisect good 1c55ca14b0e11848b5c0cd0d31ed21b61d06eca9
# status: waiting for bad commit, 1 good commit known
# bad: [69ae847273aa2b0a64bdb07cf19d3f6fbaaa6b71] windows: fix: mess up full screen mode on config reload
git bisect bad 69ae847273aa2b0a64bdb07cf19d3f6fbaaa6b71
# bad: [929e86225db2916e0e88fbc61ee703f925789bac] cheaper case insensitive compare
git bisect bad 929e86225db2916e0e88fbc61ee703f925789bac
# bad: [338174b430d0957fd0351846b006397e0bbfc4f4] mux: fix pid file locking
git bisect bad 338174b430d0957fd0351846b006397e0bbfc4f4
# bad: [9f6595d76e3d79821adaba678bd32afc03e100cf] chore: Update Cargo.lock
git bisect bad 9f6595d76e3d79821adaba678bd32afc03e100cf
# bad: [e56b169cc41f2244c2bff20381a1dc14c7574095] mux: add lua api equivalent to move-pane-to-new-tab
git bisect bad e56b169cc41f2244c2bff20381a1dc14c7574095
# bad: [59503034c795b3294d40e856820eb67fe472a74c] tidy up some debug logging
git bisect bad 59503034c795b3294d40e856820eb67fe472a74c
# bad: [d491c736ef6e320004e62270ec18036e698ffac7] When a modal is active, it gets first dibs on key processing
git bisect bad d491c736ef6e320004e62270ec18036e698ffac7
# good: [500934bc9c4c9274a0ea7914e48ab3c808d0f3f3] palette: exclude copy mode actions unless copy mode is active
git bisect good 500934bc9c4c9274a0ea7914e48ab3c808d0f3f3
# first bad commit: [d491c736ef6e320004e62270ec18036e698ffac7] When a modal is active, it gets first dibs on key processing
# good: [500934bc9c4c9274a0ea7914e48ab3c808d0f3f3] palette: exclude copy mode actions unless copy mode is active
git bisect good 500934bc9c4c9274a0ea7914e48ab3c808d0f3f3
# first bad commit: [d491c736ef6e320004e62270ec18036e698ffac7] When a modal is active, it gets first dibs on key processing

@icecreammatt
Copy link
Sponsor Author

icecreammatt commented Apr 8, 2023

Confirmed that if I pull latest and revert d491c736ef6e320004e62270ec18036e698ffac7 that resolves the issue I'm seeing.

Screen Shot 2023-04-08 at 1 45 53 PM

@sarphiv
Copy link

sarphiv commented Apr 8, 2023

I am having the same issue on Fedora 37 with a layout set via xkbcomp and through gnome.

@icecreammatt icecreammatt changed the title (MacOS) Keybindings not respected in CommandPalette Keybindings not respected in CommandPalette Apr 8, 2023
@icecreammatt
Copy link
Sponsor Author

@sarphiv if you pull latest and revert d491c736ef6e320004e62270ec18036e698ffac7 does that resolve the issue?

@wez wez added the keyboard Keyboard mapping/handling label Apr 8, 2023
@sarphiv
Copy link

sarphiv commented Apr 8, 2023

@icecreammatt I just tried the revert.
I can confirm that it does not work on 69ae847273aa2b0a64bdb07cf19d3f6fbaaa6b71 (latest), and that when i revert d491c736ef6e320004e62270ec18036e698ffac7 it works.

@wez
Copy link
Owner

wez commented Apr 8, 2023

Can you try this patch?

diff --git a/wezterm-gui/src/termwindow/keyevent.rs b/wezterm-gui/src/termwindow/keyevent.rs
index 4d67f0c6b..2484a04e9 100644
--- a/wezterm-gui/src/termwindow/keyevent.rs
+++ b/wezterm-gui/src/termwindow/keyevent.rs
@@ -287,6 +287,7 @@ impl super::TermWindow {
         }

         if is_down {
+            if only_key_bindings == OnlyKeyBindings::No {
                 if let Some(modal) = self.get_modal() {
                     if let Key::Code(term_key) = self.win_key_code_to_termwiz_key_code(keycode) {
                         let tw_raw_modifiers = window_mods_to_termwiz_mods(raw_modifiers);
@@ -300,6 +301,7 @@ impl super::TermWindow {
                         }
                     }
                 }
+            }

             if let Some((entry, table_name)) = self.lookup_key(
                 pane,

@sarphiv
Copy link

sarphiv commented Apr 8, 2023

@wez The patch fixes it on my system.

wez added a commit that referenced this issue Apr 8, 2023
Need to defer to the second pass (when we have mapped from physical
keys) before we route the key event to the modal.

refs: #3470
@wez wez added the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Apr 8, 2023
@wez
Copy link
Owner

wez commented Apr 8, 2023

This should be resolved now in main.

It typically takes about an hour before commits are available as nightly builds for all platforms. Linux builds are the fastest to build and are often available within about 20 minutes. Windows and macOS builds take a bit longer.

Please take a few moments to try out the fix and let me know how that works out. You can find the nightly downloads for your system in the wezterm installation docs.

If you prefer to use packages provided by your distribution or package manager of choice and don't want to replace that with a nightly download, keep in mind that you can download portable packages (eg: a .dmg file on macOS, a .zip file on Windows and an .AppImage file on Linux) that can be run without permanently installing or replacing an existing package, and can then simply be deleted once you no longer need them.

If you are eager and can build from source then you may be able to try this out more quickly.

@icecreammatt
Copy link
Sponsor Author

Confirmed that fixed it on MacOS too. Thanks!

@github-actions
Copy link

github-actions bot commented May 9, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. keyboard Keyboard mapping/handling
Projects
None yet
Development

No branches or pull requests

3 participants