Question about notepad++ double click behavior between certain characters



  • Hello there, greetings. I have a question about the double click behavior on notepad++. Specifically, I have noticed that certain symbols will stop the double click selection.

    For example, take this string of text.

    wordsandtext-notepad-morestuff

    If I were to double click the word ‘notepad’ in the following string of text, the selection of text would stop at both of the dash ‘-’ characters. Both before and after the word ‘notepad’.

    My question therefore, is there anyway to modify which characters notepad++ respects as stopping points for a double click selection? If at all possible, I would like to remove all such respect for any characters, so that I can select an entire line of text with a double click.

    I exhaustively looked through all of the available options within notepad++, but could not find anything that looked relevant. I am hoping someone more knowledgeable and experienced, either with notepad++ or computing in general, can be of assistance.

    Thanks guys for reading my message and for any help offered.



  • @CarverOf-Canyons

    Here’s the setting that you would want to experiment with for this:

    b02a1733-48b0-4f82-b990-bccfca4e7dc5-image.png



  • Hello, @carverof-canyons, @alan-kilborn and All,

    It is very important to point out that the characters added to the zone add character as part of word, in the Preferences... > Delimiter dialog, are, indeed, considered, by Notepad++, as pseudo-word chars !

    For instance, let’s assume the initial text of 3 lines :

    1 ABCDE wordsandtext-notepad-morestuff ABCDE
    2 ABCDEwordsandtext-notepad-morestuffABCDE
    3 ABCDE wordsandtext-notepad-morestuff ABCDE
    

    and that you previously added the - character in the zone, mentioned by @alan-kilborn

    • The expression wordsandtext-notepad-morestuff is considered as a true word in lines 1 or 3 :

    • After a double-click on that expression

    • After a search of wordsandtext-notepad-morestuff in normal mode, with the Match whole word only ticked

    • After a search of \bwordsandtext\-notepad\-morestuff\b, in regular expression mode

    However :

    • The regex \w still does not consider that the dash is a word character

    • The regex \w+ still begins after a - char and still ends before a - char

    So, in order to mimic the new set of words characters, you should use, for instance, the new regex syntaxes [\w-] and [\w-]+

    Best Regards,

    guy038



  • Thank you very much @alan-kilborn and @guy038 for your very helpful responses! I was able to play around with the delimeter settings and was able to select entire paragraphs with a double click. That’s certainly a cool way of trying to get close to the functionality that I wanted.

    I was hoping to ask one last final question if you’d let me. When I use the triple click method or the scintilla command SCI_LINECOPY to select an entire line of text, the cursor always goes immediately to the far left of the next line below it. So when I copy a line in this manner, upon pasting it, I always end up getting an extra blank line below whatever I am pasting. Is there anyway to stop notepad++ from always pasting in a blank line below whatever information I copied from a triple click on the line above?



  • Hello , @CarverOf-Canyons

    Please follow this information ,To Question about notepad++ double click behavior between certain characters

    Go to “Settings > Preferences > Delimiter”

    Add all characters you want in the box “Add your character as part of word”. In the screenshot below I’ve added hyphen and comma. When I double click on word notepad the whole string is selected.

    image1.png

    I hope this information will be usefull.
    Thank You.



  • @Prahlad-Makwana4145

    Nothing new there. :-(



  • Hi, @carverof-canyons, @alan-kilborn and All,

    @carverof-canyons, you said :

    I was hoping to ask one last final question if you’d let me. When I use the triple click method or the scintilla command SCI_LINECOPY to select an entire line of text, the cursor always goes immediately to the far left of the next line below it. So when I copy a line in this manner, upon pasting it, I always end up getting an extra blank line below whatever I am pasting. Is there anyway to stop notepad++ from always pasting in a blank line below whatever information I copied from a triple click on the line above?

    I think that you could easily get this behaviour, by adding, for instance, the 3 macro definitions, below, in your active shortcuts.xml file :

            <Macro name="Cut        Current Line w/o EOL" Ctrl="no" Alt="yes" Shift="yes" Key="88">           <!--  Alt + Shift + X  -->
                <Action type="0" message="2312" wParam="0" lParam="0" sParam="" />   <!-- Go Very Beginning   SCI_HOME          (51) -->
                <Action type="0" message="2315" wParam="0" lParam="0" sParam="" />   <!-- Select to Very End  SCI_LINEENDEXTEND (68) -->
    
                <Action type="0" message="2177" wParam="0" lParam="0" sParam="" />   <!-- Ctrl + X            SCI_CUT           (01) -->
            </Macro>
    
            <Macro name="Copy     Current Line w/o EOL" Ctrl="no" Alt="yes" Shift="yes" Key="67">             <!--  Alt + Shift + C  -->
                <Action type="0" message="2312" wParam="0" lParam="0" sParam="" />   <!-- Go Very Beginning   SCI_HOME          (51) -->
                <Action type="0" message="2315" wParam="0" lParam="0" sParam="" />   <!-- Select to Very End  SCI_LINEENDEXTEND (68) -->
    
                <Action type="0" message="2178" wParam="0" lParam="0" sParam="" />   <!-- Ctrl + C            SCI_COPY          (02) -->
                <Action type="0" message="2306" wParam="0" lParam="0" sParam="" />   <!-- Right Arrow         SCI_CHARRIGHT     (36) -->
            </Macro>
    
            <Macro name="Replace Current line by Clipboard" Ctrl="no" Alt="yes" Shift="yes" Key="86">         <!--  Alt + Shift + V  -->
                <Action type="0" message="2312" wParam="0" lParam="0" sParam="" />   <!-- Go Very Beginning   SCI_HOME          (51) -->
                <Action type="0" message="2315" wParam="0" lParam="0" sParam="" />   <!-- Select to Very End  SCI_LINEENDEXTEND (68) -->
    
                <Action type="0" message="2179" wParam="0" lParam="0" sParam="" />   <!-- Ctrl + V            SCI_PASTE         (03) -->
            </Macro>
    

    Note that the Scintilla messages to get the very beginning of current line SCI_HOME ( 2312 ) and, then, extend selection to the very end of current line SCI_LINEENDEXTEND ( 2315 ) are not the default ones, used within N++ !

    Indeed, the default Home operation is controlled by the SCI_VCHOMEWRAP message and the default Shift + End operation by the SCI_LINEENDWRAPEXTEND message

    However, the 2312 and 2315 Scintilla messages, used in the 3 macros, are preferred, because, on their own, they work properly, whatever :

    • the present cursor location, in current line

    • the current line is wrapped, or not ( View > Word wrap )

    • the current line is split on several lines, preceded, or not, by any indentation

    • the current line begins, or not, by some blank characters

    • the EOL characters of current line ( \r\n, \n or \r )

    • the current line is not terminated by any EOL characters ( case of the very last line of the file )

    • the Line Wrap type, ( Settings > Preferences...> Editing > Line Wrap ) : Default, Aligned or Indent


    Also, in summary :

    • In order to cut line contents, you may use, either :

      • The default N++ shortcut Ctrl + L ( SCI_LINECUT ), which cuts the entire current line, with its line-break, in the Clipboard

      • The new macro shortcut Alt + Shift + X, which cuts the current line, w/o its line-break, in the Clipboard

    • In order to copy line contents, you may use, either :

      • The default N++ shortcut Ctrl + Shift + X ( SCI_LINECOPY ), which copies the entire current line, with its line-break, in the Clipboard

      • The new macro shortcut Alt + Shift + C, which copies the current line, w/o its line-break, in the Clipboard

    • In order to copy the Clipboard contents, you may use, either :

      • The default N++ shortcut Ctrl + V ( SCI_PASTE ), which copies the Clipboard contents, at cursor location

      • The new macro shortcut Alt + Shift + V, which replaces the current line, w/o its line-break, by the Clipboard contents

    Just play around with these different functions to test it and get acquainted to ;-))


    Remark :

    • The Cut Current Line w/o EOL macro just deletes the lines contents, without its line-break, and copies it into the Clipboard. However, the line-break of current line is kept. If you also want to get rid of this line-break, simply add a SCI_CLEAR message to this macro, giving :
            <Macro name="Cut        Current Line w/o EOL" Ctrl="no" Alt="yes" Shift="yes" Key="88">           <!--  Alt + Shift + X  -->
                <Action type="0" message="2312" wParam="0" lParam="0" sParam="" />   <!-- Go Very Beginning   SCI_HOME          (51) -->
                <Action type="0" message="2315" wParam="0" lParam="0" sParam="" />   <!-- Select to Very End  SCI_LINEENDEXTEND (68) -->
    
                <Action type="0" message="2177" wParam="0" lParam="0" sParam="" />   <!-- Ctrl + X            SCI_CUT           (01) -->
                <Action type="0" message="2180" wParam="0" lParam="0" sParam="" />   <!-- Delete              SCI_CLEAR         (05) -->
            </Macro>
    

    Best Regards,

    guy038

    P.S. :

    Previously, I answered to similar requests ! Refer to :

    https://community.notepad-plus-plus.org/topic/12525/replace-current-line-without-inserting-a-new-line/19

    https://community.notepad-plus-plus.org/topic/12525/replace-current-line-without-inserting-a-new-line/24

    and more recently :

    https://community.notepad-plus-plus.org/topic/15859/copy-line-without-line-feed/6


    And, after some re-testing, I think that the macros described, in this post, which have been shortened, seem to be just as effective ;-))



  • My hat is off to you @guy038 that has to be the single most helpful response I’ve ever gotten to any of my questions posted on the internet for any topic. The amount of knowledge and research that went into that answer is breath-taking at the least. That you would take the time out of your day to help me like this… God bless you sir.

    Your macros work perfectly for the desired functionality I was trying to achieve. I suspected that Macros would be an interesting way to attack this problem. But I had such little personal experience with them, I got overwhelmed trying to research them and I gave up too quick.

    But lucky for me, a genius responded to my call for help and solved my question like a warm knife through butter. Of course that genius is none other than you!

    Are you a paid staff member around here? I find it astonishing that someone would be that courteous and helpful just on a volunteer basis.

    Also, thank you to Prahlad-Makwana4145 and Alan Kilborn for also helping.



  • Hello, @carverof-canyons and All,

    Thank you so much for your appreciation. No, I’m not a paid staff member, at all ! Just a volunteer, who loves N++ and be happy to help people when I guess a possible solution ;-))

    And, anyway, I am confined at home, in France, like everywhere else, in the world. So, presently, I have plenty of time to think about some problems !

    Cheers,

    guy038


Log in to reply