vis

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

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

commit 022ea46cfa5349d752add872d94ddf55b8495731
parent b37a0d7e6453dbd9f4fdc6b221d77104311c0350
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun, 19 Mar 2017 09:56:40 +0100

vis: make sure g_ does not cross line boundaries

This also eliminates dead code as reported by CID 142387.

Diffstat:
Mtext-motions.c | 10++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/text-motions.c b/text-motions.c @@ -149,14 +149,8 @@ size_t text_line_finish(Text *txt, size_t pos) { Iterator it = text_iterator_get(txt, end); if (!text_iterator_char_prev(&it, &c) || c == '\n') return end; - while (text_iterator_byte_get(&it, &c) && blank(c)) { - if (c == '\n') { - it.pos++; - break; - } - text_iterator_char_prev(&it, NULL); - } - return it.pos; + while (blank(c) && text_iterator_char_prev(&it, &c)); + return it.pos + (c == '\n'); } size_t text_line_end(Text *txt, size_t pos) {