aboutsummaryrefslogtreecommitdiff
path: root/text-motions.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-04-10 20:58:48 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-04-10 21:34:14 +0200
commit041d162922e679723110e362eeaf6cbdd9892ca9 (patch)
treec3ebc9bcaf051a3390a2c3e6cb2122d13d83262a /text-motions.c
parent5bb264e8fc771ef5f24afa531231cbde5066c162 (diff)
downloadvis-041d162922e679723110e362eeaf6cbdd9892ca9.tar.gz
vis-041d162922e679723110e362eeaf6cbdd9892ca9.tar.xz
Highlight matching cursor symbol
Diffstat (limited to 'text-motions.c')
-rw-r--r--text-motions.c9
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, &current))
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)) {