Double Click Select Copy and Paste in find and replace
-
I use notepad++ all the time more recently as the main editor for PHP development.
I live everything about this app apart from the double click select.
If I want to perform multiple ‘find and replace’ on a large array (say simple name change) if the array is
$arraName['something']; $arrayName['somethingElse'];
with hundreds of elements and I decide to change the arrayName to $aryNm Then double clicking $arrayName will only select the text, not the $ sign, but when double clicking in the find and replace box the $ IS selected, similarly if selecting the something element double clicking will select the text only; but if $arrayName[‘something’] was in the ‘find and replace’ text boxes it selects the quotes and square brackets, Is there any way to ensure the same behavior (I don’t care which) is shown in both places?
Thanks
-
So my first reaction was “who double-click selects something in the ‘find what’ or ‘replace with’ boxes?” I have never ever thought of doing this. But…that’s what I like about discussions like this: maybe you learn something that others do that could be useful to yourself…
I believe the difference in what is selected in each case is because in the Find dialog edit boxes what happens is “Windows” behavior (sure enough, try it in the filename part of a Save-As dialog), and what happens when you double-click select in a Notepad++ editor window is a “Scintilla” behavior.
Since you don’t care which behavior you end up with, as long as it is consistent, I think the best path is trying to match what happens when you double click in an editor window to the “Windows” behavior. This could probably be best done with a Pythonscript that runs when a double-click event is detected. The harder part is likely a definite characterization of what happens in the “Find what” in all situations.
-
I agree with @Alan-Kilborn, trying to change scintillas behavior would be much easier
than how the file dialog handles the selection.
But instead of trying to solve it via the double click event, I would try to solve it by
modifying what is considered to be a word.
One of the latest npp version introduced a setting to modify this.
Settings->Preferences->Delimiter->Word charcater list. Add the dollar sign to it.Cheers
Claudia -
Would using the Pythonscript editor.setWordChars() function do the same thing?
-
yes, that is the call which npp calls as well.
Just keep in mind, that npp does this for every document you open, means
you may want to call editor.setWordChars() within the BUFFERACTIVATED callback
to have exactly the same behavior.
But then, it doesn’t make sense to use the python script way. ;-)Cheers
Claudia -
Be careful with what you wish.
The Scintilla double click selection is tuned for selection which is useful for most developers in most languages. It is extremely useful for quick delete/copy-paste/find/etc.
The Windows double click selection seems much cruder, respecting mainly slashes.
Forcing Scintilla logic to match Windows may help the very specific use case that currently annoys you but will break everything else.