From 3aa603c0e72a35bb2fb5d6b31f5a3d509f8178bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 19 Mar 2017 09:56:40 +0100 Subject: vis: make sure g_ does not cross line boundaries This also eliminates dead code as reported by CID 142387. --- text-motions.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/text-motions.c b/text-motions.c index f590f33..ee8220e 100644 --- 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) { -- cgit v1.2.3