Home Download Buy Blog Forum Support

[Bug] Bracket highlighting doesn't work over large distances

[Bug] Bracket highlighting doesn't work over large distances

Postby alexrussell on Thu Mar 29, 2012 10:44 am

I have noticed this specifically in PHP and on OSX but my guess is it is a global issue for ST2. (And yes I'm using inbuilt functionality, not the BracketsHighlighter plugin.)

If I have the following code:
Code: Select all
if ($condition) {
   // ...bunch of code...
}

If the 'bunch of code' stuff goes over maybe 100 lines (or some large amount of lines that goes over a-screen-height-and-a-bit worth of lines) then if you place the cursor next to the opening or closing bracket the matcher/highlighter appears to look like it's working. Indentation guides highlight to the correct level, and the bracket has the underline. Great - but now I want to scroll up or down to the matching bracket to see where it was but leave my cursor next to the other bracket (because I'm going to want to insert here n a bit and just wanted to see if the closing bracket I'm on is for the right 'if' (say I have a load of nested 'if's)). As I scroll everything looks like it works, until the bracket my cursor is next to is maybe 5 or so lines outside of the viewport, and then all of this highlighting stops. The matching bracket is not underlined and my indentation guides stop being highlighted as the correct indentation level. If I fold some code in betwene so that the brakctes are on the same screen or near enough to it, then the behaviour is correct, it's just if there's some scrolling involved.

My guess is that maybe for optimisation/resources purposes you kill the cursor when it's far enough out of the viewport, but this has the unfortunate effect of also killing this highlighting and bracket matching.

I can make an exemplary video if you'd like. Hopefully it makes sense though.


Edit:

Just seen update to 2191 and can confirm it's still present.
There also appears to be another bug where the brackets don't match sometimes. This is likely due to my PHP code not being properly recognised by the parser (it is 100% valid PHP though!), and will be hard to debug what's going on there.
alexrussell
 
Posts: 74
Joined: Fri Jul 15, 2011 9:06 am

Re: [Bug] Bracket highlighting doesn't work over large distances

Postby alexrussell on Thu Mar 29, 2012 11:03 am

Hmm I take it back, the bracket does get highlighted as I wanted (I just missed it). But there's still the bug with indent guides. In fact it's not justa bug with highlighting the guides, depending on the file you have they sometimes even disappear! But the disappearing act only appears to be an issue if there's a load of whitespace - probably because these lines themselves are not indented:

Unhighlighed.png
This is valid php, just with a lot of blank lines. The picture here shows what the indentation guides look like if the cursor is placed in the blank lines below the indentation guides cutoff.
Unhighlighed.png (39.67 KiB) Viewed 1098 times

Highlighted.png
This is valid php, just with a lot of blank lines. The picture here shows what the indentation guides look like if the cursor is placed in the blank lines above the indentation guides cutoff.
Highlighted.png (39.38 KiB) Viewed 1098 times



Code is basically the below but with a lot more blank lines:
Code: Select all
<?php
   if (1) {
      if (2) {
         // some code

         // that's long

         // really long

         // you call that long?

         // this is long!
      }
   }
alexrussell
 
Posts: 74
Joined: Fri Jul 15, 2011 9:06 am

Re: [Bug] Bracket highlighting doesn't work over large distances

Postby bizoo on Thu Mar 29, 2012 12:16 pm

Take a look at http://www.sublimetext.com/forum/viewtopic.php?f=3&t=2311&start=0

For your use case, IMHO using ctrl+m is way better than scrolling the view to find the highlighted bracket.
Is ctrl+m working for you ?
bizoo
 
Posts: 873
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: [Bug] Bracket highlighting doesn't work over large distances

Postby alexrussell on Thu Mar 29, 2012 6:35 pm

bizoo wrote:Take a look at http://www.sublimetext.com/forum/viewtopic.php?f=3&t=2311&start=0

For your use case, IMHO using ctrl+m is way better than scrolling the view to find the highlighted bracket.
Is ctrl+m working for you ?

A-ha, thanks for that. I did do a cursory search of the forum, but there's waaaaay too many posts about BracketHighlighter that spam up the results for the core bracket matching stuff.

Yes ctrl+m works, and I use it a lot, but sometimes I don't want it to jump per se, but instead I need to *look* at where I'm going, and sometimes I want to leave the cursor where it is (okay ctrl + m twice does that to an extent, but still. Dunno, it's just caught me a few times.

The character limit certainly explains why in one occasion (my example with a bunch of newlines) it'll work fine over many lines, and in others (a PHP function with actual code) it'll break in only a few lines of code. Oh well, at least I know now, as much as I'd like the limit to be increased...
alexrussell
 
Posts: 74
Joined: Fri Jul 15, 2011 9:06 am


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 18 guests