-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Remove redundant loop in s:getchar() #232
base: master
Are you sure you want to change the base?
Remove redundant loop in s:getchar() #232
Conversation
319b1ab
to
0b3b433
Compare
0b3b433
to
2c615f4
Compare
Part of #232, Thanks to @rene-descartes2021
@@ -272,17 +261,14 @@ function! s:getchar() abort | |||
return '<CR>' | |||
endif | |||
|
|||
let input .= which_key#char_handler#parse_raw(c) | |||
if s:has_children(input) |
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.
This loop was introduced to distinguish the mappings like gc
and gcc
as initially reported in #3, I guess it's still useful.
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.
Oh ok I wasn't completely sure what was going on so I left this as a draft till I could figure things out better.
endif | ||
endwhile | ||
let c = which_key#char_handler#parse_raw(c) | ||
if has_key(s:KEYCODES, c) |
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.
This change has been incorporated into #240, thank you!
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.
Sounds good!
* Convert "\<Tab>" to "<Tab>" The mapping `<Tab>` is tracked in the mappings in String form, while the returned value from `getchar()` is a Number, convert it to String manually so that the corresponding entry in `s:runtime` can be retrieved. Close #135 * Handle more special keys properly Part of #232, Thanks to @rene-descartes2021
Changes:
s:getchar()
pathway, appears the loop there is redundant and erroneous. Redundant with respect to thewait_for_input()->s:handle_input()->s:show_next_level_mappings()
recursion which progressively refiness:runtime
with:s:getchar()
accumulates an input longer than one character, as the followingcall s:handle_input(get(s:runtime, char))
will error as there is no key in s:runtime longer than one character. I'm not sure how this bug doesn't appear to surface, and I suspect that the loop isn't ever entered, but I could be wrong.