[Feature Request] Increase number of delimiters
-
In Preferences > Delimiter, it’s only possible to set one delimiter for Ctrl+Mouse double-click. It would be much more user-friendly if this was increased so we can set as many delimiters as we like.
-
And then how would Notepad++ know which delimiter set you intend when you invoke the feature?
Note also that the Ctrl+doubleclick feature doesn’t work so well when multi-editing is enabled.
-
This post is deleted! -
@Alan-Kilborn said in [Feature Request] Increase number of delimiters:
Note also that the Ctrl+doubleclick feature doesn’t work so well when multi-editing is enabled.
So that explains it. Actually, my experience is that it’s the other way around. I have never intentionally used the Ctrl+double-click feature to select between parentheses… and I had always wondered why when I’m trying to Multi-Edit Ctrl+Double-click that it worked fine when my text was in some sections of code, but not in a function’s parameter list. Now that this discussion has reminded me, it explains why I’ve always had difficulty doing multi-edit whole-word selection inside parameter lists. If I delete those delimiters, now my Multi-Edit works the way I want it to! (I know this doesn’t help @deleelee – sorry – but it’s nice to find out and eliminate the cause of a minor annoyance).
-
@Alan-Kilborn said in [Feature Request] Increase number of delimiters:
And then how would Notepad++ know which delimiter set you intend when you invoke the feature?
Sorry, I don’t understand. I’m not suggesting we have multiple entries in the Delimiter Open and Close boxes, if that’s what you thought I meant. I mean separate Open and Close entries for different delimiters.
If the delimiters are set, for example, as ( and ), then Ctrl+Double-Mouse Click selects the contents only within that particular set of ( ) ie: it doesn’t select contents of all sets of ( ). So why can’t we have other sets of delimiters? Like this:
Or am I missing something about how the delimiters work?
-
@PeterJones said in [Feature Request] Increase number of delimiters:
I know this doesn’t help @deleelee – sorry
No worries, I’m glad I made the post if it helped eliminate “the cause of a minor annoyance” for you 😁👍
-
@deleelee said in [Feature Request] Increase number of delimiters:
I mean separate Open and Close entries for different delimiters.
That’s not necessarily a bad idea. But how many delimiter pairs should Notepad++ allow? Too many, and that Preferences page gets overcrowded; too few, and the next user will come and complain “why does Notepad++ only allow 3? I want to define four delimiter pairs”, and the next will complain “why only 4, why not as many as I want?”.
(For example, some might also want
<
bla bla bla>
to work with a Ctrl+DoubleClick, and others might also want smart quotes“
bla bla bla”
or their native quotes like„
bla bla bla“
or«
bla bla bla»
or「
bla bla bla」
…)I actually would suggest that the Open and Close be implemented as two space-separated lists, where the matching pair will be the character in the same position in the list, like:
- Delimiters:
- Open:
( [ { < «「
- Close:
) ] } > » 」
- Open:
… so if you have all of those defined, each of those pairs will behave as a “unit” for the Ctrl+DoubleClick behavior.
But no matter how much I like the idea, or how much I quibble with the number of entries available, nothing will happen unless someone makes an official request, as per our FAQ.
- Delimiters:
-
@PeterJones said in [Feature Request] Increase number of delimiters:
I actually would suggest that the Open and Close be implemented as two space-separated lists
The only issue I see with this is that some people may want to define ‘unmatched’ delimiters (eg: ( to open and ] to close) and there could be a conflict with them defined in the space-separated list. That’s why I suggested separate entries for each set. I don’t know why anyone would want unmatched delimiters but someone out there is bound to.
-
@PeterJones said in [Feature Request] Increase number of delimiters:
nothing will happen unless someone makes an official request
Done!
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/14033 -
Would it make more sense to use Scintilla’s brace matching for this instead? As best I can tell, the current delimiter matching logic in Notepad++ is not as sophisticated as what Scintilla uses to match braces for highlighting. What I’m suggesting is to start at the double-clicked position and work forward, backward or outward (not sure which would prove best; intuitively and without thinking hard about it, I think the results would be identical) testing each candidate brace found with SCI_BRACEMATCH (or SCI_BRACEMATCHNEXT) until a match is found which encloses the double-clicked position.
A quick test suggests that Scintilla generally knows how to regard quotes, escapes, and so on when matching braces. I don’t know if it makes use of information from the active lexer — the documentation doesn’t say it does, but it doesn’t say it doesn’t, either. I haven’t tested enough to determine whether Scintilla adjusts its understanding of escapes and quotes to match the current language, but my guess is that it would.
Perhaps the enhanced function, without the user needing to specify anything, would be more valuable than retaining or extending the current Ctrl+doubleclick behavior?
-
@deleelee said in [Feature Request] Increase number of delimiters:
The only issue I see with this is that some people may want to define ‘unmatched’ delimiters (eg: ( to open and ] to close)
I believe that by “matching pair”, in his reply, @PeterJones meant whatever you define it to be, so it can be
(]
if you want so.
His general suggestion on space-separated lists covers that, so you can include that as an alternative in your github request.