Selecting a phrase, number or expression

Art Joe
2010-08-19
2012-11-13
  • Art Joe

    Art Joe - 2010-08-19

    Hi,
    I am trying to modify or tweak how notepad++ selects a phrase, word, number or an expression when using mouse. This is not specific to any language rather in normal text file.

    For example in case of an IP address 10.1.1.1; if I double click on it using mouse it only selects 10 or 1. I would like to change that so that by double clicking I can select whole IP Address in one go.

    After quite a bit of search I found following post. As I am complete novice I don’t know who to make this work.
    https://sourceforge.net/projects/notepad-plus/forums/forum/331754/topic/1476621?message=3689479

    I’ll appreciate if some one can help me with this.
    Thanks
    Art

     
  • cchris

    cchris - 2010-08-19

    Don's answer doesn't seem to solve your problem, and Notepad++ doesn't handle it at this point.
    What you'd need is to ad some chaacter (the dot) to the list of the characters Scintilla considers as part of a word. This is possible using a script run through NppExec - unless you prefer using some other scripting language.
    Or you may wish to ask for customised word character sets in user defined languages, that could be another route. But you'll have to request it on IdeaTorrent, and to hope it gets implemented.

    CChris

     
  • Art Joe

    Art Joe - 2010-08-20

    Thank you very much for your reply and clarification.

     
  • Dave Brotherstone

    You can enable this in Python Script - if you add it the following to the startup script, it will work for both views.  Change the drop down from the "Configuration" menu option to "ATSTARTUP" to get it to run when Notepad++ starts.

    editor1.setWordChars('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.')
    editor2.setWordChars('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.')
    

    Obviously you can tweak the characters with this.

    Cheers,
    Dave.

     
  • Art Joe

    Art Joe - 2010-09-06

    Dave,
    This works perfectly and will save me lot of time daily.

    Thank you so much…
    Art

     
  • Art Joe

    Art Joe - 2010-09-09

    Hi,
    Is it possible to tweak this script so it will be enabled on all Tabs. What I noticed is that script is active only on initial Tab. I have to run the script for every other tab that I open.
    Regards,
    Art

     
  • Dave Brotherstone

    That's odd - I wouldn't imagine N++ sets the word chars for each file, but anyway, the answer is yes… :)

    def set_word_chars(args):
        editor.setWordChars('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.')
    notepad.callback(set_word_chars, [NOTIFICATION.BUFFERACTIVATED])
    

    I've not got time at the moment to test this actually works, but it should do.

    Dave.

     
  • cchris

    cchris - 2010-09-10

    N++ does not update the word character set, which is a problem sometimes. I haveplans for tewaking this on a per language basis - it already works for UDLs in my modified version.

    CChris

     
  • Sing

    Sing - 2011-08-18

    @ davegb3
    The script you post worked randomly.
    If you open some  files, and switch between them, some times, the word chars is using the notepad++'s default.

    i am using notepad++ 5.9.3 & Python Script 0.9.2.0

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks