-
Notifications
You must be signed in to change notification settings - Fork 132
fix: don't require <> in config key parsing #407
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
Conversation
|
I just realised I commented on the old, somewhat-related PR... Feel free to let me know if I should change things up. Also, maybe it's just my set up, but hitting ctrl+j on a highlighted unstaged file opened my text editor, when I think it should be moving the cursor down one line. Probably worth giving this code a proper "shake". |
|
Started reviewing this now. Think it looks pretty good so far. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just thinking about the commit message (and generated changelog).
Perhaps it'd be nice to communicate a bit more:
- feat(config): Removed support of sequences of keys
abc - feat(config): Removed requirement of
<>around special keys - fix(config): Print error an error message when a bound key is invalid
or something like that. What do you think?
It may be a pain to split the PR into these commits, adding empty commits is fine too imo.
As long as you prefix it with feat or fix then there'll be a changelog entry.
https://github.com/altsem/gitu/blob/master/docs/dev-tooling.md
In the meantime I'll ponder whether changelog generation is really worth it 🤡
|
I'm just rolling with the latest version of clippy in CI, so it breaks sometimes whenever new linting rules are added. I pushed a fix for it in master, so if you rebase, it should fix it. |
|
Thanks for the review! I'll try to do everything indicated soon. Also I've just looked at ctrl+j again; when I hit that, |
|
It appears that on linux terminals, |
cbd88e6 to
a89b53b
Compare
|
Sorry for the delay, I hope these new commits follow what you want to see. I did look into breaking up the logic into separate commits, but if it's possible this is pretty difficult because the logic is quite coupled. So I've opted to make 1 or the 3 commits empty, and another with just clippy lints. Regarding the |
|
@cjordan No problem! I think the commit situation is fine, it's just to produce a changelog which I'd do either way. I think some terminals treat ctrl+j differently, so it might've been a mistake binding it by default actually. Not sure how the landscape looks like tbh. I'll have another look :) |
altsem
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good I think. This is a much needed fix, thanks! :)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #407 +/- ##
==========================================
- Coverage 86.57% 86.22% -0.36%
==========================================
Files 70 70
Lines 6883 7004 +121
==========================================
+ Hits 5959 6039 +80
- Misses 924 965 +41 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This commit changes the `nom` key parsing code such that key bindings in a user's config do not surround special keys (e.g. "ctrl") in angle brackets. Unfortunately this means many tests need to be changes. Also, any errors encountered when parsing a user's binding config are immediately reported to the user.
Also do a bunch of clippy lints.
a89b53b to
639ae2b
Compare
Glad I could help! I'd like to use It's been a long time since I've used the GitHub UI for PRs, but it looks like I needed to rebase to appease it before merge. Now it looks like it's waiting for you... sorry about that :/ |
|
A bit late to the party here, but is it intentional that a binding of |
|
Hi there. I think a space literal should be handled by a special key code (like backspace and arrow keys etc.), but I can't check right now. I'll have a look in a few days when I get some idle time. |
This comment was marked as outdated.
This comment was marked as outdated.
|
Looks to me like the problem is the removal of support for angle-quoted keys combined with the key parser trimming the input, so the space just gets lost prior to parsing. I agree that recognizing |
This addresses a minor regression in #407 which rendered the following invalid: [bindings.root] stage = [" "] Rather than removing the trimming of the key code string, this commit fixes the problem by recognizing "space" specially, similar to e.g. "tab". As a result, the above config can be achieved with: [bindings.root] stage = ["space"]
This commit changes the
nomkey parsing code such that key bindings in a user's config do not surround special keys (e.g. "ctrl") in angle brackets. Unfortunately this means many tests need to be changes.Also, any errors encountered when parsing a user's binding config are immediately reported to the user.