kdheepak / taskwarrior-tui

`taskwarrior-tui`: A terminal user interface for taskwarrior
https://kdheepak.com/taskwarrior-tui
MIT License
1.4k stars 68 forks source link

fix: parse `shortcut.0` binding #557

Closed Maaxxs closed 2 months ago

Maaxxs commented 2 months ago

Hi, so in the ReadMe there is an example binding for shortcut.0 but when I tried it, it did not work. https://github.com/kdheepak/taskwarrior-tui/blob/4902ecdb34c549ed917635cce13148c13ac46106/README.md?plain=1#L122

I couldn't find it in the code either, so I guess it was just forgotten? Looking at line 251, I think the intended range is 0 to 9 even though the documentation and other places mention 1-9.

https://github.com/kdheepak/taskwarrior-tui/blob/4902ecdb34c549ed917635cce13148c13ac46106/src/config.rs#L249-L257

This PR adds the missing logic to react to shortcut.0 and I tried to find the places in the documentation to update it to say 0-9 instead of 1-9.

I can compile and run it and setting shortcuts.0=task sync syncs as expected. cargo test passes, too.

kdheepak commented 2 months ago

Hey thanks for making a PR!

0 was intentionally left aside for enabling a future feature. I'd like to be able to do 014<Enter> to run the 14th shortcut. This way I can offer effectively unlimited shortcuts instead of just 9. The current 1-9 would still work the way it is right now, but 0 would open a popup or prompt in the command bar (imagine like typing :wq in vim) so you can type a shortcut and hit enter.

But I haven't gotten around to implementing it yet (personal life has been getting in the way for a while now)!

Maaxxs commented 2 months ago

oh, I see! Okay.

And as I just saw, you already updated the README to display a different shortcut key :+1: which was the primary reason why I looked at the code :)

Thanks for the quick reply. I'll close this.