Notepad++: cursor past end of line / virtual spaces?

TL;DR - How can I enable virtual spaces to move the cursor past the end of a line of text?

Long version - In Notepad++, when trying to select (using the mouse) a long line of text that extends past the right edge of the window, causing it to scroll horizontally, my mouse will sometimes go slightly up or down enough to move the cursor to the adjacent (usually much shorter) line, causing the cursor to snap back to the left where that adjacent line ends; which in turn scrolls the window horizontally back to the left, making it difficult to quickly readjust and finish dragging out my selection.

Some (though woefully few) text editors have an option for "virtual spaces", or cursoring past the EOL, to make it much easier to mouse/arrow around without being restricted to existing text/whitespace.

How can I make this happen in Notepad++ (without hacking the source myself)?


Sort of a hack (sends a window message directly to the Scintilla edit control on startup), but works great:

  1. Install NppExec plugin

  2. Go to Plugins -> NppExec -> Execute

  3. Enter the following code:

    // ensure console stays hidden
    NPP_CONSOLE 0
    
    // enable virtual spaces (cursor past end of line) outside column edit mode
    SCI_SENDMSG 2596 3 0
    
    // SCI_SENDMSG == send message to Scintilla edit control
    // 2596 == the message we're sending is SCI_SETVIRTUALSPACEOPTIONS
    // 3 == send the value (SCVS_RECTANGULARSELECTION | SCVS_USERACCESSIBLE)
    // the default value is 1 (just SCVS_RECTANGULARSELECTION) for
    //   virtual spaces in column select mode only
    // you can find these values by poking around the source code a bit, or
    // see http://www.scintilla.org/ScintillaDoc.html
    
  4. Click the Save button at the bottom, and give the script a name

  5. Now go to Plugins -> NppExec -> Advanced Options

  6. On the right, under "Execute this script when Notepad++ starts", select the script name you just saved

  7. Click OK, close/reopen Notepad++, and enjoy ;)