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

ctrl-space tra #4055

Open
Amleto opened this issue Jul 25, 2023 · 6 comments
Open

ctrl-space tra #4055

Amleto opened this issue Jul 25, 2023 · 6 comments
Labels
bug Something isn't working keyboard Keyboard mapping/handling Windows Issue applies to Microsoft Windows

Comments

@Amleto
Copy link

Amleto commented Jul 25, 2023

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

20230712-072601-f4abf8fd

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

Not sure how to get nightly through winget. I have seen the couple of previous bug from mar/april referring to ctrl /, and ctrl-i. I am seeing an issue with ctrl-space.

I first found this due to being unable to get a keymap working in neovim. If I open the neovim qt terminal, then c-space works ok.

To Reproduce

in wezterm launch nvim with nvim --clean

in nvim, after pressing i to enter insert mode, ctrl + v enters a kind of 'capture' mode. Then enter ctrl + space. The initial ^ from the ctrl-v is present and hasnt been updated from the ctrl-space combination.

Configuration

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

-- This table will hold the configuration.
local config = {}

-- config.debug_key_events = true

-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
  config = wezterm.config_builder()
end

-- This is where you actually apply your config choices

-- For example, changing the color scheme:
--config.color_scheme = 'rose-pine-moon'
config.color_scheme = 'rose-pine-moon'
config.colors = {
  scrollbar_thumb = '#555588',
}


config.default_prog = { 'c:\\Program Files\\git\\bin\\bash.exe', '--login' }

config.font = wezterm.font_with_fallback({
    "CaskaydiaCove Nerd Font Mono",
    "Cascadia Code Mono",
    "JetBrains Mono",
})

-- disable ligatures
config.harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' }

config.enable_scroll_bar = true

config.keys = {
    { key = 'v', mods = 'CTRL|SHIFT', action = act.PasteFrom 'Clipboard' },
    { key = 'c', mods = 'CTRL|SHIFT', action = act.CopyTo 'Clipboard' },
}


-- multiplexing
--config.unix_domains = {
--  {
--    name = 'unix',
--  },
--}

-- This causes `wezterm` to act as though it was started as
-- `wezterm connect unix` by default, connecting to the unix
-- domain on startup.
-- If you prefer to connect manually, leave out this line.
-- config.default_gui_startup_args = { 'connect', 'unix' }


config.initial_rows = 25
config.initial_cols = 120

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

Expected Behavior

launch nvim with nvim --clean

in nvim, after pressing i to enter insert mode, ctrl + v enters a kind of 'capture' mode. Then ctrl + space should result in <C-Space> being inserted.

Check that ctrl+v functionality is working as expected (from insert mode): ctrl + v, ctrl + j should insert ^@

Logs

23:44:53.547  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: CTRL | LEFT_CTRL, leds: NUM_LOCK, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: true, handled: Handled(false) }
23:44:53.550  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > key_event KeyEvent { key: LeftControl, modifiers: CTRL | LEFT_CTRL, leds: NUM_LOCK, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: CTRL | LEFT_CTRL, leds: NUM_LOCK, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: true, handled: Handled(false) }), win32_uni_char: Some('\0') }
23:44:53.551  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > win32: Encoded input as "\u{1b}[17;29;0;1;8;1_"
23:44:53.850  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > key_event RawKeyEvent { key: Physical(Space), modifiers: CTRL | LEFT_CTRL, leds: NUM_LOCK, phys_code: Some(Space), raw_code: 32, scan_code: 57, repeat_count: 1, key_is_down: true, handled: Handled(false) }
23:44:53.853  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > key_event KeyEvent { key: Char(' '), modifiers: CTRL | LEFT_CTRL, leds: NUM_LOCK, repeat_count: 1, key_is_down: true, raw: Some(RawKeyEvent { key: Physical(Space), modifiers: CTRL | LEFT_CTRL, leds: NUM_LOCK, phys_code: Some(Space), raw_code: 32, scan_code: 57, repeat_count: 1, key_is_down: true, handled: Handled(false) }), win32_uni_char: Some(' ') }
23:44:53.855  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > win32: Encoded input as "\u{1b}[32;57;32;1;8;1_"
23:44:53.943  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > key_event RawKeyEvent { key: Physical(Space), modifiers: CTRL | LEFT_CTRL, leds: NUM_LOCK, phys_code: Some(Space), raw_code: 32, scan_code: 57, repeat_count: 1, key_is_down: false, handled: Handled(false) }
23:44:53.946  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > key_event KeyEvent { key: Char(' '), modifiers: CTRL | LEFT_CTRL, leds: NUM_LOCK, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(Space), modifiers: CTRL | LEFT_CTRL, leds: NUM_LOCK, phys_code: Some(Space), raw_code: 32, scan_code: 57, repeat_count: 1, key_is_down: false, handled: Handled(false) }), win32_uni_char: Some(' ') }
23:44:53.948  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > win32: Encoded input as "\u{1b}[32;57;32;0;8;1_"
23:44:54.124  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > key_event RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: false, handled: Handled(false) }
23:44:54.127  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > key_event KeyEvent { key: LeftControl, modifiers: NONE, leds: NUM_LOCK, repeat_count: 1, key_is_down: false, raw: Some(RawKeyEvent { key: Physical(LeftControl), modifiers: NONE, leds: NUM_LOCK, phys_code: Some(LeftControl), raw_code: 17, scan_code: 29, repeat_count: 1, key_is_down: false, handled: Handled(false) }), win32_uni_char: Some('\0') }
23:44:54.128  ←[32mINFO  ←[0m ←[1mwezterm_gui::termwindow::keyevent←[0m > win32: Encoded input as "\u{1b}[17;29;0;0;0;1_"

Anything else?

on windows with nvim installed, launching the nvim qt terminal handles ctrl-space as expected.

@Amleto Amleto added the bug Something isn't working label Jul 25, 2023
@Amleto
Copy link
Author

Amleto commented Jul 25, 2023

Possibly I could use this workaround that was mentioned for win terminal (not sure how to convert to wezterm config)
microsoft/terminal#2865 (comment)

@wez
Copy link
Owner

wez commented Jul 26, 2023

@wez wez added Windows Issue applies to Microsoft Windows waiting-on-op Waiting for more information from the original poster keyboard Keyboard mapping/handling labels Jul 26, 2023
@Amleto
Copy link
Author

Amleto commented Jul 26, 2023

Thanks for the reply.

I tried different combinations of enable_csi_u_key_encoding and allow_win32_input_mode, but didn't see any differences.

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

After some experimenting I have had success with this workaround in the context of Neovim (I have not tested it elsewhere):

local act = wezterm.action
local config = {}

config.default_prog = { 'pwsh.exe' }

config.keys = {
  {
    key = ' ',
    mods = 'CTRL',
    action = act.SendKey {
      key = ' ',
      mods = 'CTRL',
    },
  }
}

return config

@Amleto
Copy link
Author

Amleto commented Aug 27, 2023

Wow, great! This works with git-bash and neovim

@ashb
Copy link

ashb commented May 29, 2024

If anyone is on OSX and wondering why it's not working, -- ctrl-space is the default "previous input source" hotkey https://apple.stackexchange.com/questions/423971/disable-controlspace-keyboard-shortcut so if it's on (which it is by default) then Wezterm never even sees the hotkey. Disable it in osx and it should just work (none of the keymapping needed)

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 Windows Issue applies to Microsoft Windows
Projects
None yet
Development

No branches or pull requests

4 participants