peterh / liner

Pure Go line editor with history, inspired by linenoise
MIT License
1.05k stars 132 forks source link

Stop word movement plodding in consecutive whitespace #48

Closed ghost closed 9 years ago

ghost commented 9 years ago

Say the line being edited is:

Pos:    0123456789
Rune:   ab   c  d 

At the moment, if the cursor is at position 5, it takes three wordLefts to move to position 0. I'd expect one.

Similarly, if the cursor is at position 6, it takes two wordRights to move to position 9. I'd expect one.

This patch checks that not only whitespace but non-whitespace too must be present for a position to be considered a word boundary. Let me know what you think.

peterh commented 9 years ago

Thanks for the bug report, and more thanks for the patch!

Pulled.