unblevable / quick-scope

Lightning fast left-right movement in Vim
MIT License
1.43k stars 54 forks source link

Added multibyte support #12

Closed gelguy closed 6 years ago

gelguy commented 9 years ago

Issue #7.

Added multibyte support. The accepted_chars dictionary still has to be manually modified to include those multibyte characters.

The loop logic has been slightly modified to take into account the multibyte characters and the fact that \%c refers to the byte column.

Quick tests have been done on multibyte chars and chars with strdisplaywidth larger than 1.

Further tests should be done to make sure it works in all scenarios.

vyp commented 9 years ago

I might be mistaken, but I think we only want to skip the first character if we are searching forwards, not also backwards? I.e. Isn't the cursor actually before the character "it is on" (when you have a block cursor)?

gelguy commented 9 years ago

The code has been refactored so the character "under the cursor" is included. This is to get the character index which is different from the byte index. Including the cursor character makes the maths and logic easier. Since that character is now included, we can just skip that character and carry on as usual.

If there are counterexamples then there might be a bug in the code. But from what I have tested this seems to work as expected.

vyp commented 9 years ago

@gelguy No yes, I think you are correct. Thanks for the clarification.