diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-03-19 09:56:40 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-03-19 14:58:06 +0100 |
| commit | 3aa603c0e72a35bb2fb5d6b31f5a3d509f8178bd (patch) | |
| tree | 09adb3a709d514520430c54b5fea8bb36e44ae9f /text-motions.c | |
| parent | 3cab10e3a5d2363352be8256e9872bbc08cbbce7 (diff) | |
| download | vis-3aa603c0e72a35bb2fb5d6b31f5a3d509f8178bd.tar.gz vis-3aa603c0e72a35bb2fb5d6b31f5a3d509f8178bd.tar.xz | |
vis: make sure g_ does not cross line boundaries
This also eliminates dead code as reported by CID 142387.
Diffstat (limited to 'text-motions.c')
| -rw-r--r-- | text-motions.c | 10 |
1 files 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) { |
