vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 1da27097039867610604463f1a37a90cf9b331a9
parent 5dbf29306416bad5d3d8b1e44e54a22f8ddecfc8
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Mon, 16 Jan 2017 19:38:40 +0100

vis: fix single letter word text objects at start of file

Fix #464

Diffstat:
Mtext-objects.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 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)) {