From e2662dc195e8666beb5bed4cf0f50cfeb5e3df10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 28 Aug 2014 15:07:11 +0200 Subject: motion: fix movement to previous word end when right before --- text-motions.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/text-motions.c b/text-motions.c index 4dc094a..e57738c 100644 --- 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; } -- cgit v1.2.3