vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 0726291fb97ecbc0045c651381eed8097dcc5642 parent 66459cd7ef8d1b14439622d1ea2fc0b87278f2dc Author: Marc André Tanner <mat@brain-dump.org> Date: Thu, 28 Aug 2014 15:07:11 +0200 motion: fix movement to previous word end when right before Diffstat:
| M | text-motions.c | | | 5 | +++-- |
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/text-motions.c b/text-motions.c @@ -81,7 +81,7 @@ size_t text_line_finish(Text *txt, size_t pos) { do text_iterator_byte_prev(&it, NULL); while (text_iterator_byte_get(&it, &c) && c != '\n' && c != '\r' && isspace(c)); if (!isutf8(c)) - text_iterator_char_prev(&it, &c); + text_iterator_char_prev(&it, NULL); return it.pos; } @@ -118,7 +118,8 @@ size_t text_word_boundry_end_next(Text *txt, size_t pos, int (*isboundry)(int)) size_t text_word_boundry_end_prev(Text *txt, size_t pos, int (*isboundry)(int)) { char c; Iterator it = text_iterator_get(txt, pos); - while (text_iterator_byte_prev(&it, &c) && !isboundry(c)); + while (text_iterator_byte_get(&it, &c) && !isboundry(c)) + text_iterator_byte_prev(&it, NULL); while (text_iterator_char_prev(&it, &c) && isboundry(c)); return it.pos; }