guillermooo / Vintageous

Vi/Vim emulation for Sublime Text 3
http://guillermooo.bitbucket.org/Vintageous/
Other
1.64k stars 115 forks source link

n doesn't always jump to the first occurrence of search term. #1017

Closed jordwalke closed 8 years ago

jordwalke commented 8 years ago

Open a file with the following text:

replaceMe

blah blah blah replaceMe blah
guillermooo commented 8 years ago

Oh, wow, that's weird. h or ll at the critical point don't cause this issue.

jordwalke commented 8 years ago

Other movements cause issues too. For example, hitting j immediately after prevents search wrapping back up to the top entirely, no matter how many times you hit n. This is all in the code path for *. Regular / based searching works fine. Is it difficult to just unify the code paths so that * is almost as if you had hit / and then typed whatever word is under the cursor?

jordwalke commented 8 years ago

h also causes issues if you press h enough times to go one character beyond the replaced word.

And again, that is only a problem with *, not with /.

guillermooo commented 8 years ago

They both use the same search function. Not sure what's different, but I've found the cause of the bug for this case. The search functions are very old and probably quite buggy. For example, the binary search used for the reverse search needs to be fixed. I'll put in a fix when I find some time to write a few tests.

jordwalke commented 8 years ago

:+1: Awesome, @guillermooo