aboutsummaryrefslogtreecommitdiff
path: root/text-motions.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-02-25 18:50:25 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-02-25 18:50:25 +0100
commit563c2abacfa1ae0af3323f98fb753c9c91f927f5 (patch)
treefdbef7b53c62a7a98ef811066d42380c6aa59f88 /text-motions.c
parent502ea3175d7484222467b9bbd15ba38bca0a6ec3 (diff)
downloadvis-563c2abacfa1ae0af3323f98fb753c9c91f927f5.tar.gz
vis-563c2abacfa1ae0af3323f98fb753c9c91f927f5.tar.xz
vis: make ^ and g_ only skip blank (spaces+tabs) characters
Diffstat (limited to 'text-motions.c')
-rw-r--r--text-motions.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/text-motions.c b/text-motions.c
index 322e115..ae8944f 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -8,6 +8,7 @@
#include "util.h"
#include "text-objects.h"
+#define blank(c) ((c) == ' ' || (c) == '\t')
#define space(c) (isspace((unsigned char)c))
#define boundary(c) (isboundary((unsigned char)c))
@@ -137,7 +138,7 @@ size_t text_line_begin(Text *txt, size_t pos) {
size_t text_line_start(Text *txt, size_t pos) {
char c;
Iterator it = text_iterator_get(txt, text_line_begin(txt, pos));
- while (text_iterator_byte_get(&it, &c) && c != '\r' && c != '\n' && space(c))
+ while (text_iterator_byte_get(&it, &c) && blank(c))
text_iterator_byte_next(&it, NULL);
return it.pos;
}
@@ -148,7 +149,7 @@ 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) && space(c)) {
+ while (text_iterator_byte_get(&it, &c) && blank(c)) {
if (c == '\n') {
it.pos++;
break;