(Granted) SurroundSelection Option ?

Features wanted...
GreetingsFromPoland
Posts: 279
Joined: 29 Sep 2022 14:20
Location: Win10 @125%

(Granted) SurroundSelection Option ?

Post by GreetingsFromPoland »

hi! when coding in NPP, VSCodium, PHPStorm, etc., one feature i use all the time is something called "SurroundSelection". it allows to you surround your selection with whatever you type, e.g. single quote, double quotes, parenthesis, brackets, etc.

i was using inline rename to take LaRoy Texas 2023 to LaRoy Texas (2023) and thought it would be nice if i could double-click on 2023 (which i can, it selects the word), but then press ( and it would wrap it like this (2023).

right now i start the inline rename, use the arrow keys to scoot the cursor before the word, press ( then scoot to the end of the word and press ), etc.

if added, certain character would have their match added, so typing ( would wrap () and [ would wrap [], " would simply be " " and ' would be ' '.

it's something i do hundreds of times a day in my IDE, thought it would be neat to have an option in XY for the same.
Last edited by GreetingsFromPoland on 22 Jun 2024 15:14, edited 1 time in total.

admin
Site Admin
Posts: 63672
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SurroundSelection Option ?

Post by admin »

Interesting, here is an animated illustration of it: https://devblogs.microsoft.com/visualst ... xperiment/

Not immediately planned, but maybe later...

GreetingsFromPoland
Posts: 279
Joined: 29 Sep 2022 14:20
Location: Win10 @125%

Re: SurroundSelection Option ?

Post by GreetingsFromPoland »

hi! with the recent updates to the inline edits (lowercase, uppercase, etc.), any chance you can revisit this wish ?

matewo
Posts: 97
Joined: 03 Jun 2018 21:35

Re: SurroundSelection Option ?

Post by matewo »

Hi GreetingsFromPoland,

not an integrated way in XYplorer, but have you tried AHK (AutoHotKey) or Espanso?

Both work application independent.

Best regards, Markus

https://www.autohotkey.com/
https://espanso.org/

admin
Site Admin
Posts: 63672
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SurroundSelection Option ?

Post by admin »

GreetingsFromPoland wrote: 19 Jun 2024 16:22 hi! with the recent updates to the inline edits (lowercase, uppercase, etc.), any chance you can revisit this wish ?
Good timing. :) Next beta...

eil
Posts: 1801
Joined: 13 Jan 2011 19:44

Re: SurroundSelection Option ?

Post by eil »

If user selects part of text and uses "ending quote" like ) > ] then it will result into adding "starting quote" from next pair. Example: Picture)Old<Style.
Can't say it's a bug cause in some circumstances it may be a feature, but some users may consider it a bug.
Win 7 SP1 x64 100% 1366x768|1900x1080

admin
Site Admin
Posts: 63672
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SurroundSelection Option ?

Post by admin »

LOL, I totally forgot about this kind of abuse. I guess I should prevent it.

eil
Posts: 1801
Joined: 13 Jan 2011 19:44

Re: SurroundSelection Option ?

Post by eil »

I'd propose no matter if user pushed ( or ), < or > it will properly cover selected text into () and <>.
Win 7 SP1 x64 100% 1366x768|1900x1080

admin
Site Admin
Posts: 63672
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SurroundSelection Option ?

Post by admin »

That's an interesting idea. Are there any SurroundSelection standards out there?

PS: Another option would be to reverse the order in this case: abc + ) --> )abc(

eil
Posts: 1801
Joined: 13 Jan 2011 19:44

Re: SurroundSelection Option ?

Post by eil »

admin wrote: 20 Jun 2024 18:17 reverse the order in this case: abc + ) --> )abc(
That's better, adds more options.
Win 7 SP1 x64 100% 1366x768|1900x1080

admin
Site Admin
Posts: 63672
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SurroundSelection Option ?

Post by admin »

Exactly :tup:

GreetingsFromPoland
Posts: 279
Joined: 29 Sep 2022 14:20
Location: Win10 @125%

Re: SurroundSelection Option ?

Post by GreetingsFromPoland »

admin wrote: 20 Jun 2024 18:17 That's an interesting idea. Are there any SurroundSelection standards out there?
hi! not sure about any standard out there; however, in Notepad++, PHPStorm and VSCodium (the 3 i tried), pressing ( or ) wraps it with it's match.
for example, abc + ) ==> (abc), abc + ( ==> (abc), abc + > ==> <abc> and abc + < ==> <abc>.

GreetingsFromPoland
Posts: 279
Joined: 29 Sep 2022 14:20
Location: Win10 @125%

Re: SurroundSelection Option ?

Post by GreetingsFromPoland »

v26.10.0203 - 2024-06-20 20:27
* Surround Selection: Now when you type the second character of the pair, the selected
text will be surrounded by the pair in reverse order.
hi! to me, this change makes no sense at all. am i the only one that thinks this ? unless i am mistaken, i don't believe any other software that supports "surround selection" does this. what would be the purpose of reverse order ? what am i missing ?

the beauty in surround selecting was that you could select either part of the pair and it was smart enough to properly surround it.

admin
Site Admin
Posts: 63672
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SurroundSelection Option ?

Post by admin »

It's mentioned above: adds more options.

GreetingsFromPoland
Posts: 279
Joined: 29 Sep 2022 14:20
Location: Win10 @125%

Re: SurroundSelection Option ?

Post by GreetingsFromPoland »

eil wrote: 20 Jun 2024 20:15
admin wrote: 20 Jun 2024 18:17 reverse the order in this case: abc + ) --> )abc(
That's better, adds more options.
there appears to be a bug. selecting text and pressing ] results in base ]2024{.

also, argh., this is not better. still makes no sense to me and is opposite from other implementations. the base wish was to surround your selection with a pair, no matter what side was typed. no other "options" were needed. i can't see any reason why the reverse would ever be needed or used.

Post Reply