vis

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

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

commit df42b0f87715bc62b7a94d750e0eda5007d01ce9
parent 4a64834cd7be14b319639226bda5baad9334e31a
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Fri, 24 Jan 2020 10:45:42 +0100

text: unconditionally use REG_NOTEOL for backward searches

This fixes empty backward searches ?$ starting at the line end.

Diffstat:
Mtext-motions.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/text-motions.c b/text-motions.c @@ -634,9 +634,7 @@ size_t text_search_backward(Text *txt, size_t pos, Regex *regex) { size_t start = 0; size_t end = pos; RegexMatch match[1]; - char c; - int flags = text_byte_get(txt, end, &c) && c == '\n' ? 0 : REG_NOTEOL; - bool found = !text_search_range_backward(txt, start, end, regex, 1, match, flags); + bool found = !text_search_range_backward(txt, start, end, regex, 1, match, REG_NOTEOL); if (!found) { end = text_size(txt);