onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.35k stars 299 forks source link

Keymap Unbind Requires Matching Keychord Order #2556

Open cmpadden opened 6 years ago

cmpadden commented 6 years ago

Oni Version: 0.3.6 Operating System: MacOS

Issue: Unbinding default keybindings requires the order of the key-chord to match its original definition from oni/browser/src/Input/KeyBindings.ts.

Expected behavior: oni.input.unbind("<c-s-b>") unbinds sidebar.toggle

Actual behavior: oni.input.unbind("<c-s-b>") does not unbind sidebar.toggle oni.input.unbind("<s-c-b>") does unbind sidebar.toggle

oni-bot[bot] commented 6 years ago

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

akinsho commented 6 years ago

@cmpadden thanks for raising this issue thats really helpful to know as its probably behind a lot of key binding issues, haven't had a look at that part of the code base but it should definitely not be looking for an exact match or rather should only work if the pattern matches the original

cmpadden commented 6 years ago

I spent some time looking at InputManager.ts and KeyboardResolver.ts in an attempt to come up with a solution to this problem, but I'm not sure if I'm making any progress. My initial idea was to modify the line that normalizes the keychord in both the bind and unbind functions.

const normalizedKeyChord = keyChord.toLowerCase()

But, I'm not sure of all of the key combinations to account for, and how it might impact performance.

@Akin909, Do you have any suggestions that might point me in the right direction?

Thanks