First of all to be clear, braces are `{` and `}` and in most languages they 
enclose blocks of code/data and in their common formatting they do not occur 
consecutively.  Because braces often enclose large blocks of code/data, goto 
matching brace is very useful since the matching brace is often off screen, so 
its highlighting is not visible.  Since braces do not commonly occur 
consecutively, the current Geany algorithm works correctly without saved 
state[0] and returns the cursor to its original position after two "goto 
matching brace" commands.  

The issue comes when expanding the algorithm to include non-brace brackets eg 
`()[]<>` since these can commonly occur consecutively and the OP behaviour of 
highlighting the wrong target bracket may occur.  However non-brace brackets 
also commonly do not enclose as much code as braces do[1] and so the 
highlighted matching bracket is visible, making goto less useful for non-brace 
brackets and its issues with consecutive pairs therefore less important.

It is inappropriate to break the useful behaviour of the important use-case to 
correct behaviour in the less important use-case.

[0] Technically the state information is being saved in the resulting position 
of the cursor after goto, but I mean there is no separate state information 
saved elsewhere to return the cursor to its original position.

[1] except in Lisp :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1998#issuecomment-473723176

Reply via email to