diff options
Diffstat (limited to 'text-motions.c')
| -rw-r--r-- | text-motions.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/text-motions.c b/text-motions.c index 00e3cc8..d2f272c 100644 --- a/text-motions.c +++ b/text-motions.c @@ -329,12 +329,17 @@ size_t text_paragraph_prev(Text *txt, size_t pos) { } size_t text_bracket_match(Text *txt, size_t pos) { + return text_bracket_match_except(txt, pos, NULL); +} + +size_t text_bracket_match_except(Text *txt, size_t pos, const char *except) { int direction, count = 1; char search, current, c; Iterator it = text_iterator_get(txt, pos); if (!text_iterator_byte_get(&it, ¤t)) return pos; - + if (except && memchr(except, current, strlen(except))) + return pos; switch (current) { case '(': search = ')'; direction = 1; break; case ')': search = '('; direction = -1; break; @@ -347,7 +352,7 @@ size_t text_bracket_match(Text *txt, size_t pos) { case '"': case '`': case '\'': { - char special[] = " \n)}]>.,"; + char special[] = " \n)}]>.,:;"; search = current; direction = 1; if (text_iterator_byte_next(&it, &c)) { |
