aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--text-motions.c6
-rw-r--r--text-motions.h4
-rw-r--r--view.c2
-rw-r--r--vis-motions.c2
4 files changed, 7 insertions, 7 deletions
diff --git a/text-motions.c b/text-motions.c
index 550466b..f406da3 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -550,17 +550,17 @@ size_t text_function_end_prev(Text *txt, size_t pos) {
}
size_t text_bracket_match(Text *txt, size_t pos) {
- return text_bracket_match_except(txt, pos, NULL);
+ return text_bracket_match_symbol(txt, pos, NULL);
}
-size_t text_bracket_match_except(Text *txt, size_t pos, const char *except) {
+size_t text_bracket_match_symbol(Text *txt, size_t pos, const char *symbols) {
int direction, count = 1;
char search, current, c;
bool instring = false;
Iterator it = text_iterator_get(txt, pos);
if (!text_iterator_byte_get(&it, &current))
return pos;
- if (except && memchr(except, current, strlen(except)))
+ if (symbols && !memchr(symbols, current, strlen(symbols)))
return pos;
switch (current) {
case '(': search = ')'; direction = 1; break;
diff --git a/text-motions.h b/text-motions.h
index 57aa09e..32e4a1f 100644
--- a/text-motions.h
+++ b/text-motions.h
@@ -103,8 +103,8 @@ size_t text_section_prev(Text*, size_t pos);
*/
/* search coresponding '(', ')', '{', '}', '[', ']', '>', '<', '"', ''' */
size_t text_bracket_match(Text*, size_t pos);
-/* same as above but ignore symbols contained in last argument */
-size_t text_bracket_match_except(Text*, size_t pos, const char *except);
+/* same as above but explicitly specify symbols to match */
+size_t text_bracket_match_symbol(Text*, size_t pos, const char *symbols);
/* search the given regex pattern in either forward or backward direction,
* starting from pos. does wrap around if no match was found. */
diff --git a/view.c b/view.c
index e417995..4182cc5 100644
--- a/view.c
+++ b/view.c
@@ -610,7 +610,7 @@ void view_draw(View *view) {
c->line->cells[c->col].cursor = true;
if (view->ui && !c->sel) {
Line *line_match; int col_match;
- size_t pos_match = text_bracket_match_except(view->text, pos, "<>");
+ size_t pos_match = text_bracket_match_symbol(view->text, pos, "(){}[]\"'`");
if (pos != pos_match && view_coord_get(view, pos_match, &line_match, NULL, &col_match)) {
line_match->cells[col_match].selected = true;
}
diff --git a/vis-motions.c b/vis-motions.c
index 07090c0..399d51d 100644
--- a/vis-motions.c
+++ b/vis-motions.c
@@ -174,7 +174,7 @@ static size_t window_nop(Vis *vis, Win *win, size_t pos) {
}
static size_t bracket_match(Text *txt, size_t pos) {
- size_t hit = text_bracket_match_except(txt, pos, "<>\"'`");
+ size_t hit = text_bracket_match_symbol(txt, pos, "(){}[]");
if (hit != pos)
return hit;
char current;