diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-01-16 19:38:40 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-01-16 19:38:40 +0100 |
| commit | b68ad55ab405a61449b448463d3ce0da38176534 (patch) | |
| tree | 4ea8b4e9d24e0a7727cc1e1012a04824dc2cc45c | |
| parent | 06fe6bc8d437a59d2aa6b1de43f72afd5578fab3 (diff) | |
| download | vis-b68ad55ab405a61449b448463d3ce0da38176534.tar.gz vis-b68ad55ab405a61449b448463d3ce0da38176534.tar.xz | |
vis: fix single letter word text objects at start of file
Fix #464
| -rw-r--r-- | text-objects.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/text-objects.c b/text-objects.c index 052e150..bbf043d 100644 --- a/text-objects.c +++ b/text-objects.c @@ -33,7 +33,7 @@ static Filerange text_object_customword(Text *txt, size_t pos, int (*isboundary) Iterator it = text_iterator_get(txt, pos); if (!text_iterator_byte_get(&it, &c)) return text_range_empty(); - if (text_iterator_byte_prev(&it, &prev)) + if (pos > 0 && text_iterator_byte_prev(&it, &prev)) text_iterator_byte_next(&it, NULL); text_iterator_byte_next(&it, &next); if (space(c)) { @@ -79,7 +79,7 @@ static Filerange text_object_customword_outer(Text *txt, size_t pos, int (*isbou Iterator it = text_iterator_get(txt, pos); if (!text_iterator_byte_get(&it, &c)) return text_range_empty(); - if (text_iterator_byte_prev(&it, &prev)) + if (pos > 0 && text_iterator_byte_prev(&it, &prev)) text_iterator_byte_next(&it, NULL); text_iterator_byte_next(&it, &next); if (space(c)) { |
