GNOME Bugzilla – Bug 384029
"Highlight matching bracket" option doesn't highlight brackets with more than 2000 characters between them
Last modified: 2009-12-29 14:31:25 UTC
That bug has been opened on https://launchpad.net/distros/ubuntu/+source/gtksourceview/+bug/74893 "gedit fails to highlight matching brackets which have more than 2000 characters between them. If I have a long-ish block of code in which the opening and closing brackets are greater than 2000 characters apart, I'm unable to leave the input cursor sitting next to one and have the other be highlighted when I scroll to it. If they are less than 2000 characters apart, things work as expected. Steps to reproduce: 1) Open gedit 2) Enable the "highlight matching bracket" option in preferences 3) Insert a "{" on line 1 4) Insert 2000 characters of your choice, followed by a "}" 5) Leave the cursor next to one of the brackets and then scroll to the other bracket. The bracket will not be highlighted. If you remove a character and repeat, the bracket will be highlighted as expected. Seems like this is a simple fix." The gtksourceview code has that limit: gtksourceview/gtksourcebuffer.c:#define MAX_CHARS_BEFORE_FINDING_A_MATCH 2000 Do you use it for performances reason? I've asked to the submitter what number he would consider appropriate for it
We did it for performance problems.
Comment from the submitter: "Yeah, I have a /lot/ of code blocks that go over that number. For instance, the block of code that I first noticed this issue with is only about 70 lines long, but it still manages to hit the 2000 character limit. 70 lines with an average of ~30 characters per line really isn't much, especially when ~50 of those lines are visible in the editor at once. I took a look at the upstream bug you filed, and its response, and I would be interested to know what kind of performance problems were encountered before the limit was instituted (and why this was seen as the best solution). I just experimented a bit myself and found that gedit's performance remained adequate (to me), even with the limit you mentioned having been increased to 65536. However, I did perceive what seemed like a slight amount of "hitching" when rapidly moving between many lines with brackets which needed matching. It seems like this could potentially be alleviated by waiting for the user to let up on the cursor keys before figuring out which bracket matches what is at the cursor position. What are your thoughts?" Maybe setting the limit to 4000 would not make a real performances difference and work for most people?
from the submitter: "4000 is still pretty low... do you suppose it would be feasible to add a gconf key to control this behavior?"
*** Bug 531832 has been marked as a duplicate of this bug. ***
For what it's worth, the limit is 10000 now.
I am finally closing this, since it has been bumped to 10000 we didn't get complaints