<p>First of all to be clear, braces are <code>{</code> and <code>}</code> 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.</p>
<p>The issue comes when expanding the algorithm to include non-brace brackets eg <code>()[]<></code> 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.</p>
<p>It is inappropriate to break the useful behaviour of the important use-case to correct behaviour in the less important use-case.</p>
<p>[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.</p>
<p>[1] except in Lisp :)</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/1998#issuecomment-473723176">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ5Z6wmQKMTN6A3K_ZFpdjNQO1mLTks5vXsYOgaJpZM4YziNa">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJyB6eOWIMNMzkiPANOPGI0E4CibQks5vXsYOgaJpZM4YziNa.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"PERSON","message":"@elextr in #1998: 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.  \r\n\r\nThe issue comes when expanding the algorithm to include non-brace brackets eg `()[]\u003c\u003e` 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.\r\n\r\nIt is inappropriate to break the useful behaviour of the important use-case to correct behaviour in the less important use-case.\r\n\r\n[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.\r\n\r\n[1] except in Lisp :)"}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1998#issuecomment-473723176"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/issues/1998#issuecomment-473723176",
"url": "https://github.com/geany/geany/issues/1998#issuecomment-473723176",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>