From 041d162922e679723110e362eeaf6cbdd9892ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 10 Apr 2015 20:58:48 +0200 Subject: Highlight matching cursor symbol --- text-motions.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'text-motions.c') 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)) { -- cgit v1.2.3