jesseduffield / lazygit

simple terminal UI for git commands
MIT License
49.66k stars 1.76k forks source link

Keymapping rejected #2953

Open Talkabout opened 1 year ago

Talkabout commented 1 year ago

Describe the bug After update to version 0.40.2 I am not able to map <c-h> key.

To Reproduce Steps to reproduce the behavior:

  1. Map any function to <c-h> in config.yaml
  2. Open lazygit

Expected behavior I'd like to be able to use this keybinding again

Screenshots image

Version info: commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=linux, arch=amd64, git version=2.39.2

stefanhaller commented 1 year ago

Which version of lazygit were you using before upgrading to 0.40.2? As far as I can see, it was never possible to map <c-h>. I tried 0.37, and got the same error message.

The reason is probably that for a terminal, <c-h> is indistinguishable from backspace.

stefanhaller commented 1 year ago

Oh wait, I'm stupid, I tested wrong. It was indeed possible to map <c-h> until v38.2.

Bisecting points at 2e66d87b949. I didn't investigate further whether or how it's possible to fix this.

Talkabout commented 1 year ago

Hi @stefanhaller, thanks for your investigation! I guess the fix is not that difficult, this key combination needs to be added to the "allowed" list. It was removed during the commit you linked, but my assumption is that it was removed because it was not contained by the other list of keys that was "synced" in the mentioned change.

stefanhaller commented 1 year ago

No, it's not so simple. Adding <c-h> to this list doesn't work, it complains that the entry is already in the list (under the name of <backspace>, which is the same key).

But this shows us a workaround: in 0.38, mapping a command to <c-h> or to <backspace> achieved exactly the same thing. Mapping to <backspace> still works in 0.40.2, so just do that and you'll be able to type ctrl-H to perform your command.

Untangling this better requires deeper investigation that I don't have time for right now...

Talkabout commented 1 year ago

Thank you @stefanhaller, the workaround works and I can live with it for now.