vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 0ae46be59ee3150940fc03898ce62b4c0cca514d
parent 78ad678468e9489071c21934e20c704bc7802d6d
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat, 27 Sep 2014 15:22:07 +0200

Simplify text_line_finish

Diffstat:
Mtext-motions.c | 6+-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/text-motions.c b/text-motions.c @@ -25,8 +25,6 @@ static int is_word_boundry(int c) { ('A' <= c && c <= 'Z')); } -// TODO: consistent usage of iterators either char or byte based where appropriate. - size_t text_begin(Text *txt, size_t pos) { return 0; } @@ -126,10 +124,8 @@ size_t text_line_start(Text *txt, size_t pos) { size_t text_line_finish(Text *txt, size_t pos) { char c; Iterator it = text_iterator_get(txt, text_line_end(txt, pos)); - do text_iterator_byte_prev(&it, NULL); + do text_iterator_char_prev(&it, NULL); while (text_iterator_byte_get(&it, &c) && c != '\n' && isspace(c)); - if (!ISUTF8(c)) - text_iterator_char_prev(&it, NULL); return it.pos; }