aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2018-02-24 19:13:35 +0100
committerMarc André Tanner <mat@brain-dump.org>2018-02-27 18:56:28 +0100
commitf55312ba450c845e65f62b5592696d5f6ae98cda (patch)
treedbfd09938f6df95a1ab244fe850653a23f750dd9
parent234e1b1579e92f66e75720a04e1179288831f231 (diff)
downloadvis-f55312ba450c845e65f62b5592696d5f6ae98cda.tar.gz
vis-f55312ba450c845e65f62b5592696d5f6ae98cda.tar.xz
text-motion: ignore blank lines for next/prev paragraph motions
-rw-r--r--text-motions.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/text-motions.c b/text-motions.c
index 16137aa..d44e623 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -446,19 +446,17 @@ size_t text_paragraph_next(Text *txt, size_t pos) {
char c;
Iterator it = text_iterator_get(txt, pos);
- while (text_iterator_byte_get(&it, &c) && c == '\n')
+ while (text_iterator_byte_get(&it, &c) && (c == '\n' || blank(c)))
text_iterator_char_next(&it, NULL);
- return text_line_empty_next(txt, it.pos);
+ return text_line_blank_next(txt, it.pos);
}
size_t text_paragraph_prev(Text *txt, size_t pos) {
char c;
Iterator it = text_iterator_get(txt, pos);
- /* c == \0 catches starting the search at EOF */
- while (text_iterator_byte_get(&it, &c) && (c == '\n' || c == '\0'))
- text_iterator_byte_prev(&it, NULL);
- return text_line_empty_prev(txt, it.pos);
+ while (text_iterator_byte_prev(&it, &c) && (c == '\n' || blank(c)));
+ return text_line_blank_prev(txt, it.pos);
}
size_t text_line_empty_next(Text *txt, size_t pos) {