You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix 1-based index causing incorrect insertion of an empty word
Completing on a command line with a one-letter word at the end would
incorrectly cause an empty word to be inserted before that character:
↙ cursor immediately after "a" (character 5)
cmd a
-----
\_ parsed to ['cmd', '', 'a'] instead of ['cmd', 'a']
This was due to `$this->charIndex` being zero-based, and `$cursor` being
one-based; the condition `$cursor >= $this->charIndex` was always off by
one. I'm have no idea what compelled me to write this with a one-based
index in the first place, but all the tests are passing and I've tested
this change in the console with a real application.
It took a while to understand this function again, so I've put a few
more helpful comments in for the next adventurer to pass by.
Fixes#65
0 commit comments