aboutsummaryrefslogtreecommitdiff
path: root/text-motions.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-25 11:31:38 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-25 11:31:38 +0200
commit5d43998c54d35358d154ad99add19cd1130f9f3e (patch)
treed9069a1285cc179a99eb9d60d918f2b88b8667f4 /text-motions.c
parentd8bf6b83391edb8be69ce390e788785ddb0b806f (diff)
downloadvis-5d43998c54d35358d154ad99add19cd1130f9f3e.tar.gz
vis-5d43998c54d35358d154ad99add19cd1130f9f3e.tar.xz
Revert "Change semantics of text_line_end"
This reverts commit 3a24e6a5562e4b1ea456fbe36607bd8a9c92744d.
Diffstat (limited to 'text-motions.c')
-rw-r--r--text-motions.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/text-motions.c b/text-motions.c
index b215ffc..69afcc7 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -119,7 +119,9 @@ 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);
while (text_iterator_byte_get(&it, &c) && c != '\n' && isspace(c));
+ if (!ISUTF8(c))
text_iterator_char_prev(&it, NULL);
return it.pos;
}
@@ -129,8 +131,6 @@ size_t text_line_end(Text *txt, size_t pos) {
Iterator it = text_iterator_get(txt, pos);
while (text_iterator_byte_get(&it, &c) && c != '\r' && c != '\n')
text_iterator_byte_next(&it, NULL);
- if (text_iterator_char_prev(&it, &c) && c == '\n')
- text_iterator_byte_next(&it, NULL);
return it.pos;
}