wez / wezterm

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

win32 input mode: not processing Ctrl + Alt keyboard combinations properly #2196

Open sggutier opened 2 years ago

sggutier commented 2 years ago

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

Windows

WezTerm version

wezterm 20220626-204048-65e0bb1d

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

Entering Ctrl + Alt + B is not processed correctly. Programs such as Emacs detect Ctrl + B instead. That input used to work on the 20220417-182446-b3758860 release.

To Reproduce

No response

Configuration

local wezterm = require 'wezterm';

local custom_scheme = wezterm.get_builtin_color_schemes()["Gruvbox Light"]
custom_scheme.cursor_bg = "#52ad70"
custom_scheme.cursor_fg = "black"
custom_scheme.cursor_border = "#52ad70"

return {
  -- debug_key_events = true,
  -- enable_kitty_keyboard = false,
  keys = {
    {key="Enter", mods="ALT", action="DisableDefaultAssignment"},
    {key="raw:13", mods="ALT|SHIFT", action="DisableDefaultAssignment"},
  },
  color_schemes = {
    ["Gruvbox Prime"] = custom_scheme,
  },
  color_scheme = "Gruvbox Prime",
  -- color_scheme = "Tango Adapted",
  -- color_scheme = "Gruvbox Light",
  -- color_scheme = "Gruvbox Dark",
  -- color_scheme = "Atom One Light",
  font = wezterm.font_with_fallback({
      "Comic Code Ligatures",
      "Jetbrains Mono",
  }),
  font_size = 9.5,
  hide_tab_bar_if_only_one_tab = true,
}

Expected Behavior

No response

Logs

PS C:\Users\sggutier> wezterm
12:48:01.177  INFO   wezterm_gui::termwindow > OpenGL initialized! Intel(R) UHD Graphics 4.5.0 - Build 30.0.101.1631 is_context_loss_possible=true wezterm version: 20220626-204048-65e0bb1d
12:49:06.573  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: false, handled: Handled(false) }
12:49:06.573  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftControl, modifiers: NONE, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
12:49:06.574  INFO   wezterm_gui::termwindow::keyevent > send to pane UP key=LeftControl mods=NONE
12:49:06.575  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[17;29;0;0;0;1_"
12:49:09.801  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftAlt), modifiers: ALT, phys_code: Some(LeftAlt), raw_code: 18, scan_code: 56, repeat_count: 1, key_is_down: true, handled: Handled(false) }
12:49:09.806  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftAlt, modifiers: ALT, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftAlt), modifiers: ALT, phys_code: Some(LeftAlt), raw_code: 18, scan_code: 56, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
12:49:09.809  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=LeftAlt mods=ALT
12:49:09.810  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[18;56;0;1;2;1_"
12:49:09.813  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: true, handled: Handled(false) }
12:49:09.814  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftControl, modifiers: ALT | CTRL | LEFT_CTRL, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
12:49:09.815  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=LeftControl mods=ALT | CTRL
12:49:09.815  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[17;29;0;1;10;1_"
12:49:10.246  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(B), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(B), raw_code: 66, scan_code: 49, repeat_count: 1, key_is_down: true, handled: Handled(false) }
12:49:10.252  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('b'), modifiers: ALT | CTRL | LEFT_CTRL, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(B), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(B), raw_code: 66, scan_code: 49, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
12:49:10.257  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=Char('b') mods=ALT | CTRL
12:49:10.260  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[66;49;2;1;10;1_"
12:49:10.342  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(B), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(B), raw_code: 66, scan_code: 49, repeat_count: 1, key_is_down: false, handled: Handled(false) }
12:49:10.344  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('b'), modifiers: ALT | CTRL | LEFT_CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(B), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(B), raw_code: 66, scan_code: 49, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
12:49:10.345  INFO   wezterm_gui::termwindow::keyevent > send to pane UP key=Char('b') mods=ALT | CTRL
12:49:10.346  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[66;49;2;0;10;1_"
12:49:10.560  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftAlt), modifiers: CTRL | LEFT_CTRL, phys_code: Some(LeftAlt), raw_code: 18, scan_code: 56, repeat_count: 1, key_is_down: false, handled: Handled(false) }
12:49:10.566  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftAlt, modifiers: CTRL | LEFT_CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftAlt), modifiers: CTRL | LEFT_CTRL, phys_code: Some(LeftAlt), raw_code: 18, scan_code: 56, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
12:49:10.572  INFO   wezterm_gui::termwindow::keyevent > send to pane UP key=LeftAlt mods=CTRL
12:49:10.574  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[18;56;0;0;8;1_"
12:49:10.581  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: false, handled: Handled(false) }
12:49:10.582  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftControl, modifiers: NONE, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
12:49:10.583  INFO   wezterm_gui::termwindow::keyevent > send to pane UP key=LeftControl mods=NONE
12:49:10.584  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[17;29;0;0;0;1_"
12:49:11.182  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftAlt), modifiers: ALT, phys_code: Some(LeftAlt), raw_code: 18, scan_code: 56, repeat_count: 1, key_is_down: true, handled: Handled(false) }
12:49:11.186  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftAlt, modifiers: ALT, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftAlt), modifiers: ALT, phys_code: Some(LeftAlt), raw_code: 18, scan_code: 56, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
12:49:11.188  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=LeftAlt mods=ALT
12:49:11.188  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[18;56;0;1;2;1_"
12:49:11.189  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: true, handled: Handled(false) }
12:49:11.190  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftControl, modifiers: ALT | CTRL | LEFT_CTRL, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
12:49:11.191  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=LeftControl mods=ALT | CTRL
12:49:11.192  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[17;29;0;1;10;1_"
12:49:11.406  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(F), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(F), raw_code: 70, scan_code: 21, repeat_count: 1, key_is_down: true, handled: Handled(false) }
12:49:11.411  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('f'), modifiers: ALT | CTRL | LEFT_CTRL, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(F), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(F), raw_code: 70, scan_code: 21, repeat_count: 1, key_is_down: true, handled: Handled(false) }) }
12:49:11.413  INFO   wezterm_gui::termwindow::keyevent > send to pane DOWN key=Char('f') mods=ALT | CTRL
12:49:11.413  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[70;21;6;1;10;1_"
12:49:11.470  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(F), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(F), raw_code: 70, scan_code: 21, repeat_count: 1, key_is_down: false, handled: Handled(false) }
12:49:11.472  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: Char('f'), modifiers: ALT | CTRL | LEFT_CTRL, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(F), modifiers: ALT | CTRL | LEFT_CTRL, phys_code: Some(F), raw_code: 70, scan_code: 21, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
12:49:11.474  INFO   wezterm_gui::termwindow::keyevent > send to pane UP key=Char('f') mods=ALT | CTRL
12:49:11.474  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[70;21;6;0;10;1_"
12:49:11.655  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: ALT, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: false, handled: Handled(false) }
12:49:11.660  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftControl, modifiers: ALT, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: ALT, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
12:49:11.664  INFO   wezterm_gui::termwindow::keyevent > send to pane UP key=LeftControl mods=ALT
12:49:11.665  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[17;29;0;0;2;1_"
12:49:11.666  INFO   wezterm_gui::termwindow::keyevent > key_event RawKeyEvent { key: Physical(LeftAlt), modifiers: NONE, phys_code: Some(LeftAlt), raw_code: 18, scan_code: 56, repeat_count: 1, key_is_down: false, handled: Handled(false) }
12:49:11.667  INFO   wezterm_gui::termwindow::keyevent > key_event KeyEvent { key: LeftAlt, modifiers: NONE, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftAlt), modifiers: NONE, phys_code: Some(LeftAlt), raw_code: 18, scan_code: 56, repeat_count: 1, key_is_down: false, handled: Handled(false) }) }
12:49:11.668  INFO   wezterm_gui::termwindow::keyevent > send to pane UP key=LeftAlt mods=NONE
12:49:11.668  INFO   wezterm_gui::termwindow::keyevent > Encoded input as "\u{1b}[18;56;0;0;0;1_"

Anything else?

No response

wez commented 2 years ago

Try setting https://wezfurlong.org/wezterm/config/lua/config/allow_win32_input_mode.html to false?

sggutier commented 2 years ago

That worked nicely. Thanks a lot!

wez commented 2 years ago

Let's keep this open to track fixing the underlying problem!