1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/text-motions.c b/text-motions.c
index 1430d49..2e6f1e8 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -533,17 +533,20 @@ size_t text_bracket_match(Text *txt, size_t pos, const Filerange *limits) {
static size_t match_symbol(Text *txt, size_t pos, char search, int direction, const Filerange *limits) {
char c, current;
int count = 1;
- bool instring = false;
+ bool instring = false, escaped;
Iterator it = text_iterator_get(txt, pos);
if (!text_iterator_byte_get(&it, ¤t))
return pos;
+ escaped = false;
if (direction >= 0) { /* forward search */
while (text_iterator_byte_next(&it, &c)) {
if (limits && it.pos >= limits->end)
break;
- if (c != current && c == '"')
+ if (c != current && c == '"' && !escaped)
instring = !instring;
- if (!instring) {
+ if (instring) {
+ escaped = c == '\\';
+ } else {
if (c == search && --count == 0)
return it.pos;
else if (c == current)