Menu

Change words double click selection...

Emilio
2012-11-05
2012-12-29
  • Emilio

    Emilio - 2012-11-05

    It’s possible to change the char separators that delimitate the auto selection boundaries on double click event over a word?

    For example:

    "test_one"
    "test-two"
    

    … double click on text or one, on the first example, highlight  "

    test_one
    

    ", otherwise, on the second example double clinking on text, selects "

    test
    

    ", and on two selects "

    two
    

    ", but suppose that I want the same behavior for char separator '

    -
    

    ' than the '

    _
    

    ', it’s possible to configure that on some NPP internal property?

    Thanks in advance!
    e-milio.

     
  • Byzod

    Byzod - 2012-11-13

    I support this!
    If we can customize how hpp detect "word" with regular expressions then that's great!
    I always want to select

    ONE-WORD
    

    In string like this

    "\tONE-WORD\r\n"
    

    with

    (?<!\\)[\w\-_]+
    
     
  • Byzod

    Byzod - 2012-11-13

    npp
    sorry for the typo

     
  • cchris

    cchris - 2012-12-05

    This is a Scitilla change. N++ won't do it to make upgrading Scintilla easier.

    CChris

     
  • François-R Boyer

    This is one time I will have to tell that CChris is not completely correct ;-) It is possible to change characters considered to be in words, without modifying Scintilla, using the SCI_SETWORDCHARS and SCI_SETWHITESPACECHARS messages. Using Python Script plugin, you can set it with editor.setWordChars("abcdefg...") (list all chars you want in words) and editor.setWhitespaceChars(" \t...") (list all space chars). Note that current Notepad++ (or at least the last version of the source I verified) will reset the lists to default when double-clicking a hotspot (e.g. a URL).

     
  • cchris

    cchris - 2012-12-29

    Indeed, I wasn't able to obtain the changes to stick...
    Further, lexers have their own opinion sometimes abouut what is a word character. This is how I had been able to select word characters in UDLs: because I had full control over the lexer. For instance, you need to modify the relevant lexer to get the $ in PHP variable names to be included in the double click selection.

    So yes, you can drive Scintilla's definition of words and spaces, but the lexer change is, from N++ standpoint, a change in the Scintilla distro. So I'd say we are both right.

    CChris