View previous topic :: View next topic |
Author |
Message |
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Thu Jul 21, 2022 2:22 pm Post subject: Issue with URxvt.selection.pattern-N [SOLVED] |
|
|
I'm not sure this belongs here since it's surely not a Gentoo issue specifically. That aside: I'm trying to make modifications to the behavior of the double click selection in the urxvt terminal using this:
https://linux.die.net/man/1/urxvt-selection
The default behavior for the first double click is to select the word under the cursor. I wanted to change that to select all non-whitespace and have tried this: Code: | URxvt.selection.pattern-0: ([\\S]+) | One reason was that I'd like to be able to double click things like URLs and get all of it. However the above, for whatever reason does NOT include the ampersand (&). So far nothing I try, for example: Code: | URxvt.selection.pattern-0: ([\\S\\&]+) | ...corrects this. Am I missing something there? Seems pretty straight forward.
Thanks in advance!
Tom
Last edited by tld on Fri Jul 22, 2022 10:44 pm; edited 1 time in total |
|
Back to top |
|
|
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Thu Jul 21, 2022 6:38 pm Post subject: |
|
|
Wow. This just doesn't seem to be possible. I was suspecting that the urxvt "cutchars" might be related, but nothing I've tried seems to help.
That URxvt.selection.pattern-0 clearly IS affecting the selection, but for whatever reason refuses to include the ampersand. Odd beyond words.
Tom |
|
Back to top |
|
|
trilithium n00b
Joined: 18 Nov 2019 Posts: 43
|
Posted: Fri Jul 22, 2022 9:12 pm Post subject: |
|
|
The selection extension matches against a set of regular expressions and shows the matching strings in increasing order of length upon double-click and further clicks. It does not allow you to remove any of the built-in regular expressions, you may only add to the set using URxvt.selection.pattern-0 etc.
The shorter matches excluding ampersands you are seeing are from those built-in regular expressions. On my setup (\S+) seems to work fine for selectings URLs including ampersands – but I have to triple-click.
It is a simple Perl extension so you should be able to adapt it for your purposes. You probably only need to remove the offending expressions from @mark_patterns. |
|
Back to top |
|
|
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Fri Jul 22, 2022 10:43 pm Post subject: |
|
|
Ahhh...Thanks. That explains a lot. Actually I'm seeing the exact behavior you describe with the triple click, which I hadn't realized before. That's actually pretty good as-is. With the default setting I could only select including the "&" with a triple click, but that one included things like the newline at the end of the current line. With the \S pattern it takes four clicks to include the new line.
You're probably correct, that it wouldn't be too tough to get rid of whichever default pattern causes that, but I'm pretty OK with the way it is. Thanks!
Tom |
|
Back to top |
|
|
|