GNOME Bugzilla – Bug 756537
Improve/fix matching bracket
Last modified: 2015-10-25 14:34:47 UTC
if ((ch == '{') && find_previous_char (iter) == ')') ^.............................................^ We would expect the last one to match.
And of course bugzilla ruined the formatting! The first ( was matching the ')'
I guess we need to make the bracket matching be aware of class contexts so that we can skip "strings" etc. This would also require to add class contexts for "character" and "escape sequence".
*** Bug 629786 has been marked as a duplicate of this bug. ***
Ignoring the string and comment context classes would already be a big improvement. And, inside a string or comment, match brackets only in that string/comment?
Actually the string and comment context classes are taken into account, but there are some bugs. And in C a single character like '(' is not seen as a string, so there are problems in that case. An idea is to add the string context class for single characters too. It can be seen as a string of one char. I don't know if some code relies on the fact that the string context class, in C, delimits a real string with double quotes.
Fixed: https://git.gnome.org/browse/gtksourceview/commit/?id=63faf76e1a4d8ecf6e4b3568e015b34c7d62a476 After 4 other bug fixes and lots of code simplification for the bracket matching.