Author Topic: How can I select a block delimited by matching-paren  (Read 1731 times)

jcelle

  • Senior Community Member
  • Posts: 266
  • Hero Points: 5
How can I select a block delimited by matching-paren
« on: October 08, 2020, 08:03:21 AM »
Hello,
I couldn't find any tip about this.
I am using find-matching-paren to spot some blocks in my code but could not figure out how I could select the block.
Does anyone know if that would be possible ?
I tried to press SHIFT + F12 (f12 is find-matching-paren) but that does not seem to work...
Thanks in advance.

patrickkox

  • Senior Community Member
  • Posts: 137
  • Hero Points: 6
  • Debian GNU/Linux user
Re: How can I select a block delimited by matching-paren
« Reply #1 on: October 08, 2020, 08:37:15 AM »
When you place your cursor on a parenthesis or curly brace that you want to match, the corresponding one turns blue, if you then double-click the opening parenthesis it should select that entire code block.


This also works in reverse, so if you double-click the closing parenthesis, brackets, curly braces, it also selects the entire block. And I think you don't even need to replace the cursor (just double-clicking works fine here).

Graeme

  • Senior Community Member
  • Posts: 2827
  • Hero Points: 347
Re: How can I select a block delimited by matching-paren
« Reply #2 on: October 08, 2020, 10:03:59 AM »
also the command select-code-block  or edit -> select -> code block

used repeatedly it selects a bigger and bigger block of code.

patrickkox

  • Senior Community Member
  • Posts: 137
  • Hero Points: 6
  • Debian GNU/Linux user
Re: How can I select a block delimited by matching-paren
« Reply #3 on: October 08, 2020, 10:41:20 AM »
This made me think of something,


would something like "Rainbow Brackets" (as are available for the JetBrains IDE's and VSC) be a good addition to SlickEdit?


As I understand that makes it easier to see (at a glance) which closing bracket belongs to which opening bracket.

jcelle

  • Senior Community Member
  • Posts: 266
  • Hero Points: 5
Re: How can I select a block delimited by matching-paren
« Reply #4 on: October 08, 2020, 12:55:19 PM »
Waoh thanks patrickkox and Graeme !
So the double click works even though it does not select exactly the code but also the parenthesis and does not work for HTML tags (html tags are recognized by matching-paren).

The select-code-block function when used in PHP code selects an entire function, not the portion of code where my cursor is. Besides if I press Esc I can't remove the selection  (:o). Attaching a screenshot.

Anyway it is good to learn about these as I did not quite know about this.