diff options
author | pommicket <pommicket@gmail.com> | 2023-06-14 11:28:24 +0100 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-06-14 11:28:24 +0100 |
commit | b929933b8261889b2b0275b5809c763d0c0f32b2 (patch) | |
tree | 39d1d1144c64c646192a5860bf3e50f60367daaa /buffer.c | |
parent | 8a6fa4a33a8664d5642853418821f88c7c2930df (diff) |
fix problem where unmatched bracket highlights eof
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -2872,13 +2872,17 @@ bool buffer_pos_move_to_matching_bracket(TextBuffer *buffer, BufferPos *pos) { if (bracket_char && matching_char) { int direction = syntax_is_opening_bracket(language, bracket_char) ? +1 : -1; int depth = 1; + bool found_bracket = false; while (buffer_pos_move_right(buffer, pos, direction)) { char32_t c = buffer_char_at_pos(buffer, *pos); if (c == bracket_char) depth += 1; else if (c == matching_char) depth -= 1; - if (depth == 0) break; + if (depth == 0) { + found_bracket = true; + break; + } } - return true; + return found_bracket; } else { return false; } |