<p>If the cursor is between two brace characters there has to be a choice to highlight the preceding pair or the following pair.  Geany chooses the preceding pair.  The goto logic is consistent with the highlight logic.</p>
<p>This simple logic will always behave as you observed in the OP, whilst personally I would have chosen the following pair, the same sorts of things will happen if the choice was the following brace.</p>
<blockquote>
<p>This inside-braces/outside-braces logic was designed for a control on the quick selection</p>
</blockquote>
<p>I think its designed so the cursor comes back to the original position, if it was originally before the brace it ends up back before and if it was originally after the brace it ends up back after it, but without having to have any record of the state anywhere.  This is consistent with the use-case of finding the other end of a code block then returning to editing where you left off.</p>
<p>I don't know the history of the feature, but its called "brace" matching, so it likely was originally only {} which do not occur adjacent to one another in normal coding idioms, and the problems have come after it expanded to other forms of brackets which can occur adjacent to each other.</p>
<p>If you wish to propose an alternative logic, please describe it so it can be discussed, simply providing code (especially Lua code in a C/C++ project) and expecting contributors to decode its logic just makes your proposal harder to consider.</p>
<p>The behaviour of the extra select plugin is for that plugins maintainer to decide, if you want to change that, please raise an issue on the plugins repository, not all plugin maintainers watch here.</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-442275133">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ8SXLEjWTUweMu8_uujDuPaMjwbbks5uzdzAgaJpZM4YziNa">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJ-31FQMCuTJkQ3pmkNCtE6kZFfX3ks5uzdzAgaJpZM4YziNa.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://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.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: If the cursor is between two brace characters there has to be a choice to highlight the preceding pair or the following pair.  Geany chooses the preceding pair.  The goto logic is consistent with the highlight logic. \r\n\r\nThis simple logic will always behave as you observed in the OP, whilst personally I would have chosen the following pair, the same sorts of things will happen if the choice was the following brace.\r\n\r\n\u003e This inside-braces/outside-braces logic was designed for a control on the quick selection\r\n\r\nI think its designed so the cursor comes back to the original position, if it was originally before the brace it ends up back before and if it was originally after the brace it ends up back after it, but without having to have any record of the state anywhere.  This is consistent with the use-case of finding the other end of a code block then returning to editing where you left off.\r\n\r\nI don't know the history of the feature, but its called \"brace\" matching, so it likely was originally only {} which do not occur adjacent to one another in normal coding idioms, and the problems have come after it expanded to other forms of brackets which can occur adjacent to each other.\r\n\r\nIf you wish to propose an alternative logic, please describe it so it can be discussed, simply providing code (especially Lua code in a C/C++ project) and expecting contributors to decode its logic just makes your proposal harder to consider.\r\n\r\nThe behaviour of the extra select plugin is for that plugins maintainer to decide, if you want to change that, please raise an issue on the plugins repository, not all plugin maintainers watch here."}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1998#issuecomment-442275133"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/issues/1998#issuecomment-442275133",
"url": "https://github.com/geany/geany/issues/1998#issuecomment-442275133",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "Re: [geany/geany] A problem with \"go to matching brace\" command. (#1998)",
"sections": [
{
"text": "",
"activityTitle": "**elextr**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@elextr",
"facts": [

]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"geany/geany\",\n\"issueId\": 1998,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"geany/geany\",\n\"issueId\": 1998\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/geany/geany/issues/1998#issuecomment-442275133"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 416162650\n}"
}
],
"themeColor": "26292E"
}
]</script>