vis

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

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

commit 89627f933ee0ac02528e3c9c37283318c40edcfa
parent 22790545120bcc3f6343851f0277cc7b8b5caf6f
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat,  7 Nov 2015 23:22:38 +0100

text-motion: do not treat ' as string delimiter in match bracket

Currently symbols inside a string are ignored. This means that if
the opening (closing) symbol is inside (outside) the string while
the closing (opening) one is outside (inside), it will not be
matched.

It is not yet clear whether this "optimization" is useful.

Closes #97

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

diff --git a/text-motions.c b/text-motions.c @@ -590,7 +590,7 @@ size_t text_bracket_match_except(Text *txt, size_t pos, const char *except) { if (direction >= 0) { /* forward search */ while (text_iterator_byte_next(&it, &c)) { - if (c != current && (c == '"' || c == '\'')) + if (c != current && c == '"') instring = !instring; if (!instring) { if (c == search && --count == 0) @@ -601,7 +601,7 @@ size_t text_bracket_match_except(Text *txt, size_t pos, const char *except) { } } else { /* backwards */ while (text_iterator_byte_prev(&it, &c)) { - if (c != current && (c == '"' || c == '\'')) + if (c != current && c == '"') instring = !instring; if (!instring) { if (c == search && --count == 0)