Skip to content

JumpToMatchingBrace inconsistent with adjacent unpaired braces e.g. )[ or }( or )( #3308

@Gavin-Holt

Description

@Gavin-Holt

Hi,

I am having trouble with JumpToMatchingBrace action in my windows console. My console has a block cursor, I expect the cursor to bounce back and forth between one brace and its partner. At any point pressing delete should delete the brace i.e. the cursor is placed upon the brace.

With the current implementation the cursor moves to the right of the found brace, and if this character happens to also be a brace, repeating the action does not return to the original brace - it goes off searching downstream.

For example in the following line of Lua, clicking upon the first [, and executing JumpToMatchingBrace, will take my cursor to the first (. Executing JumpToMatchingBrace again will take the cursor past the first ) . From here further executions bounce between the first ( and a position just past the first ).

  local success = bp["JumpToMatchingBrace"](bp)

My guess is that the code has been written while watching an I beam cursor. It still malfunctions as above, but looks pretty with the cursors inside the braces. To function properly the I beam cursor always needs to locate on the left of the brace.

I have attempted to rewrite JumpToMatchingBrace in Lua, but manipulating the userdata locations is confusing.

I am similarly frustrated after several attempts to write a selectinner Lua function to select the contents of matching braces.

A nice tutorial about manipulating cursor/match location userdata would be greatly appreciated,

Kind Regards Gavin Holt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions