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

Shift+{non-letter} key bindings don’t work (such as Shift+Slash for backwards search in Vi mode) #5251

Closed
chris-morgan opened this issue Jun 17, 2021 · 4 comments

Comments

@chris-morgan
Copy link
Contributor

In my environment, various key bindings don’t work with the Shift modifier. Letters work, but a couple of symbols that I’ve tried like / (?) and . (>) aren’t working, and numbers like 3 (#). From --print-events output, the immediate cause looks to be that on non-functioning combos, the KeyboardInput event’s virtual_keycode is ending up None rather than Some(Slash) or similar.

Steps to reproduce the simplest case:

  1. Start Alacritty.
  2. Hit Ctrl+Shift+Space to enter Vi mode (stock binding { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode })
  3. Hit Shift+/ to start a backwards search (stock binding { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward }).

It should open a “Backwards search” bar at the bottom, but instead nothing happens.

System

OS: Arch Linux
Version: alacritty 0.8.0 (a1b13e6)

Confirmed under Wayland (Sway via the AUR sway-hidpi-git package), XWayland (xorg-xwayland-hdpi-git) and stock X (xorg-server + i3wm).

English (US) keyboard.

Logs

(I removed noise lines from the output since they really get in the way when viewing the content with line wrapping: NewEvents, MainEventsCleared, RedrawEventsCleared. It’d be nice if --print-events had a verbosity setting so that you could exclude these ones.)

Pressing h (works):

[2021-06-18 00:07:19.765825919] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 35, state: Pressed, virtual_keycode: Some(H), modifiers: (empty) }, is_synthetic: false } }
[2021-06-18 00:07:19.765871070] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ReceivedCharacter('h') }
[2021-06-18 00:07:19.915892655] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 35, state: Released, virtual_keycode: Some(H), modifiers: (empty) }, is_synthetic: false } }

Pressing l (works):

[2021-06-18 00:07:20.546950384] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 38, state: Pressed, virtual_keycode: Some(L), modifiers: (empty) }, is_synthetic: false } }
[2021-06-18 00:07:20.546987318] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ReceivedCharacter('l') }
[2021-06-18 00:07:20.709651271] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 38, state: Released, virtual_keycode: Some(L), modifiers: (empty) }, is_synthetic: false } }

Pressing Shift+h (works):

[2021-06-18 00:07:05.106952291] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 42, state: Pressed, virtual_keycode: Some(LShift), modifiers: (empty) }, is_synthetic: false } }
[2021-06-18 00:07:05.106987811] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ModifiersChanged(SHIFT) }
[2021-06-18 00:07:05.424169499] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 35, state: Pressed, virtual_keycode: Some(H), modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:05.424210000] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ReceivedCharacter('H') }
[2021-06-18 00:07:05.638925085] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 35, state: Released, virtual_keycode: Some(H), modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:05.985173161] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 42, state: Released, virtual_keycode: Some(LShift), modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:05.985207950] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ModifiersChanged((empty)) }

Pressing Shift+l (works):

[2021-06-18 00:07:07.382497319] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 42, state: Pressed, virtual_keycode: Some(LShift), modifiers: (empty) }, is_synthetic: false } }
[2021-06-18 00:07:07.382573351] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ModifiersChanged(SHIFT) }
[2021-06-18 00:07:07.701361516] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 38, state: Pressed, virtual_keycode: Some(L), modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:07.701394071] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ReceivedCharacter('L') }
[2021-06-18 00:07:07.904947710] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 38, state: Released, virtual_keycode: Some(L), modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:08.206314797] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 42, state: Released, virtual_keycode: Some(LShift), modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:08.206351551] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ModifiersChanged((empty)) }

Pressing Shift+/ (doesn’t work, virtual_keycode is None rather than Some(Slash)):

[2021-06-18 00:07:12.675889097] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 42, state: Pressed, virtual_keycode: Some(LShift), modifiers: (empty) }, is_synthetic: false } }
[2021-06-18 00:07:12.675930449] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ModifiersChanged(SHIFT) }
[2021-06-18 00:07:12.916904133] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 53, state: Pressed, virtual_keycode: None, modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:12.916943943] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ReceivedCharacter('?') }
[2021-06-18 00:07:13.149866392] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 53, state: Released, virtual_keycode: None, modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:13.420936351] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 42, state: Released, virtual_keycode: Some(LShift), modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:13.420971110] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ModifiersChanged((empty)) }

Pressing Shift+. (doesn’t work, virtual_keycode is None rather than Some(Period)):

[2021-06-18 00:07:14.123230730] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 42, state: Pressed, virtual_keycode: Some(LShift), modifiers: (empty) }, is_synthetic: false } }
[2021-06-18 00:07:14.123267143] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ModifiersChanged(SHIFT) }
[2021-06-18 00:07:14.334860182] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 52, state: Pressed, virtual_keycode: None, modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:14.334902175] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ReceivedCharacter('>') }
[2021-06-18 00:07:14.567166356] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 52, state: Released, virtual_keycode: None, modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:14.801181733] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 42, state: Released, virtual_keycode: Some(LShift), modifiers: SHIFT }, is_synthetic: false } }
[2021-06-18 00:07:14.801215801] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ModifiersChanged((empty)) }

Pressing . (works, virtual_keycode is Some(Period)):

[2021-06-18 00:07:15.927642123] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 52, state: Pressed, virtual_keycode: Some(Period), modifiers: (empty) }, is_synthetic: false } }
[2021-06-18 00:07:15.927679347] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ReceivedCharacter('.') }
[2021-06-18 00:07:16.119108635] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 52, state: Released, virtual_keycode: Some(Period), modifiers: (empty) }, is_synthetic: false } }

Pressing / (works, virtual_keycode is Some(Slash)):

[2021-06-18 00:07:16.734520339] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 53, state: Pressed, virtual_keycode: Some(Slash), modifiers: (empty) }, is_synthetic: false } }
[2021-06-18 00:07:16.734559016] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: ReceivedCharacter('/') }
{log noise from the search bar appearing and shuffling the terminal around}
[2021-06-18 00:07:16.961270539] [INFO ] [alacritty] glutin event: WindowEvent { window_id: WindowId(Wayland(WindowId(94747775933216))), event: KeyboardInput { device_id: DeviceId(Wayland(DeviceId)), input: KeyboardInput { scancode: 53, state: Released, virtual_keycode: Some(Slash), modifiers: (empty) }, is_synthetic: false } }
@chrisduerr
Copy link
Member

There's already several issues related to this, it's tracked upstream in rust-windowing/winit#753.

@joell
Copy link

joell commented Nov 20, 2023

The upstream issue has since been closed, but this issue remains broken for me on Alacritty 0.12.3, Arch Linux, and i3wm on Xorg.

Here are my logs from pressing Shift+4:

[80.263631481s] [INFO ] [alacritty] winit event: DeviceEvent { device_id: DeviceId(X(DeviceId(11))), event: Key(KeyboardInput { scancode: 5, state: Released, virtual_keycode: Some(Key4), modifiers: SHIFT }) }
[80.263657023s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(33554434)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), input: KeyboardInput { scancode: 5, state: Released, virtual_keycode: None, modifiers: SHIFT }, is_synthetic: false } }

Notice that the DeviceEvent correctly identifies the key as virtual_keycode: Some(Key4) but the following WindowEvent has virtual_keycode: None.

Since the upstream issue is closed and this issue remains unfixed, should it be re-opened?

@kchibisov
Copy link
Member

the issue is closed because it's fixed on master.

@joell
Copy link

joell commented Nov 20, 2023

So it is! I had only tested the latest release. I'm sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants