From b416a912c7be9718934778f66317e974fd4aa0a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 24 Jan 2020 10:45:42 +0100 Subject: text: unconditionally use REG_NOTEOL for backward searches This fixes empty backward searches ?$ starting at the line end. --- text-motions.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/text-motions.c b/text-motions.c index 067c9c8..b62dc23 100644 --- 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); -- cgit v1.2.3