lapce: Keyboard shortcuts wrong keyboard layout detection

Lapce Version

nightly-b4a6ec5

System information

Fedora Silverblue 38 Hyprland

Describe the bug

Using a non QWERTY keyboard resulting in wrong keys detection in the Keyboard Shortcuts section.

E.g. Remapping Ctrl+z is detected as Ctrl+w for undo.

In the rest of the editor everything seems working correctly even pressing Ctrl+z really performs undo action (after remapping, read my paragraph below).

Why it is really a problem? Because by default Ctrl+z is mapped to closing the file like a Ctrl+w would do… So non QWERTY keyboard users have to remap all non equivalent default shorcuts.

About this issue

  • Original URL
  • State: open
  • Created 8 months ago
  • Reactions: 12
  • Comments: 44

Most upvoted comments

Just wanting to add my +1 to this issue. Discovered and tried out lapce for the first time today. Looks really promising to be honest! Great work devs ✨ Sadly it’s currently not usable since basically all hotkeys use the wrong keys to be activated.

I’m using lapce 0.3.1 via flatpak on Fedora with sway right now. My keyboard layout is custom (should not matter which one, just not qwerty)

This is potentially fixed by https://github.com/lapce/lapce/pull/3119

Same problem on MacOS 14.1.1 with Dvorak

Can confirm that the shortcuts seems to work again (german key board + koy layout) on commit 21e6719. But it looks like strg + + does still not work for zooming. But strg + - works. (I am not sure if I had accidentally disable it, but I was not able to find the keyboard shortcut section in the settings. Update: found shortcut settings. Zoom was set to strg + =. But after changing it does still not work. In the shortcut overview it does show strg+ instead of strg++. image

Thanks for testing it. Can you please see what was the raw keyboard event in Lapce logs when you press Ctrl++

Dump question, but how do I get logs? I have try RUST_LOG=debug lapce -w but it does not output anything.

One additional information: the shortcut preview show correctly ctrl++ but after pressing save it shows only ctrl+ image

should be fixed by 0f9090640bcc72b2c230e6f122350abffaca4ec2

Same for me. Mac OS 14.1.2 with Dvorak layout. Lapce 0.3.1. Physical keyboard is a QWERTY, but the layout configured on the mac is Dvorak US. Looks like the app still see it as QWERTY. The problem started to happen after the recent update that introduced Floem for the UI

Same problem with MacOS Sonoma (french keyboard - AZERTY). Good editor and looks promising but unusable when trying to add/change new keybindings

I’m happy to report that the keybindings works with no problem here on Debian 12 Gnome Wayland with dvorak.

I’m affected by this issue as well and tried to analyze what may causing this issue.

On a german keyboard layout (qwertz) when pressing Ctrl+Z the incoming KeyEvent is

Keyboard(KeyEvent { key: KeyEvent { physical_key: Code(KeyY), logical_key: Character("z"), text: Some("z"), location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Character("z"), text_with_all_modifiers: Some("\u{1a}") } }, modifiers: ModifiersState(CONTROL) })

which is mapped to

KeyPress { key: Keyboard(Character("z"), Code(KeyY)), mods: ModifiersState(CONTROL) }

that is then used to find a command to be executed.

I experimented a little bit and tried to use the value from the logical_key to get the corresponding KeyCode to appear in the resulting KeyPress. When pressing Ctrl+Z on a qwertz keyboard I wanted the Keypress to look like this

KeyPress { key: Keyboard(Character("z"), Code(KeyZ)), mods: ModifiersState(CONTROL) }

See my PR https://github.com/lapce/lapce/pull/3001

It think this can fix many of the keyboard layout related issues but unfortunately not all. For example Ctrl+= is still not working (this is the default for zoom-in). On a german keyboard the equal sign “=” is reached by pressing Shift+0. The KeyEvent for this case will be Ctrl+Shift+= which obiously doesn’t match the keybind Ctrl+=.

So not a final solution, but a first step 😃

Anything new at this issue? It is a big deal breaker which make lape useless for all non us people/keyboards.

Same on windows with an AZERTY layout