Pink is invalid syntax (sytax highlighter; not plugin related).
I am still confused. If I showed you this, I think we would both agree the curly should not be matched because what you really have is two broken curly pairs. This is invalid bracket pairs.:
({)(})
This should match fine:
({})({})
What you are showing me is the equivalent is it not?
<?php { ?><?php } ?>
or
<{><}>
Everything is generalized in BH2. It starts matching pairs and resolving them until it comes to the closest one surrounding the cursor. Isn’t this what it is doing? You just have (by the generalized algorithms view) dangling curly brackets between valid angle brackets.
Now what you are wanting is some special case for PHP (which makes sense), but keep in mind BH1 couldn’t resolve these issues either, and ST2 doesn’t resolve them well either (if at all). HTML tags don’t have this issue because they are a special case. In HTML, we just find the surrounding angles (which will always be a valid match if the tag is formatted correctly), and if they are part of a tag, we search the buffer for tags only (this is why it doesn’t get confused resolving other brackets in between). But this is done with a special post_match BH plugin.
Here is another case that BH2 cannot resolve (C/C++ code). Which opening curly should it match to the closing?:
#if (SOME_SWITCH)
if (some_condition) {
#else
if (some_other_condition) {
#endif
dosomething();
}
There are some cases that BH is not going to be able handle very well. And the amount of code to tackle these issues can be quite a bit. Now PHP might be able to be resolved much easier than the C problem. I won’t touch the C problem at all. But maybe in the future I can come up with a PHP solution (maybe).
Now in regards to ctrl+m finding different brackets than BH, this is because ST2 uses a different algorithm than BH2. I can make the “jump between brackets” BH command work more like ctrl+m, but it will still be using BH2’s algorithm to match brackets. Currently BH2 has two separate “jump between brackets” commands. One jumps left, the other jumps right. ST2 just toggles between the two.