Virtual Spaces

  • maniiiiii

    maniiiiii - 2011-05-04

    Could anyone help me.
    I love 'Virtual Spaces' and I am unable to activate them in Notepad++. Could anyone tell me a Step-by-Step - Intruduction for activating them? They are very important to me. I am using Notepad++, as it is, at the moment and this confusing, left'n right jumping Cursor, when changing the line, is driving me crazy. The other excellent features of this Software are so great, that I even accept this silly behavior but it would heal my world, if I could activate 'Virtual Spaces'.

  • strainer

    strainer - 2011-05-04

    It is maybe related to hold down the alt key while selecting and pasting.

  • Dave Brotherstone

    I think the OP is talking about "Virtual Space", which is a feature of Scintilla, although at the moment (I think) there's no way to turn it on through the menus / settings dialog.  The Python Script plugin comes with a sample script to enable and disable it however, so you can do it that way.  Just install the Python Script plugin from plugin manager, and then click Plugins, Python Script, Scripts, Samples, Enable Virtual Space.


  • Gur Stavi

    Gur Stavi - 2013-04-29

    Do stress the importance of virtual space:
    when one writes indented code, pressing enter will automatically add spaces up to the last indent. These spaces are often neglected to be removed.
    With virtual space, on ENTER the cursor is positioned into the correct indent location in the next line but the spaces are not added if the user does not type anything.

    If this feature already exist in Scintilla I hope that it would get into the preferences dialog.


    THEVENOT Guy - 2013-04-29

    Hi, Maniiiiii and Gur Stavi,

    You can activate/desactivate the virtual space feature, very easily, with a macro.

    I, personnaly, make the test with the 6.3.1 version of N++, but it should work with older versions !

    Just for info, I begin to give you the way, to find out the message number of this Scintilla feature !

    • In the file "npp.6.3.1.src.7z\scintilla\doc\ScintillaDoc.html", click on Contents section, on the link "Multiple Selection and Virtual Space".

    • Then click on the seventh link "SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)".

    • As indicated, you need to set the two bit flags SCVS_RECTANGULARSELECTION=1 and SCVS_USERACCESSIBLE=2.

    Thus, the name of the message will be "SCI_SETVIRTUALSPACEOPTIONS" and the parameter should be "3".

    • Then, in the file "npp.6.3.1.src.7z\scintilla\include\Scintilla.h", search for the name of the message ( SCI_SETVIRTUALSPACEOPTIONS ).

    • We go, at once, to the line "#define SCI_SETVIRTUALSPACEOPTIONS 2596"
      => we get the number message !

    Now, close Notepad++, if necessary, and with an other editor ( Notepad, Wordpad, Writer... ) :

    • Open the file "shortcuts.xml" ( in a local version, it's in the \Notepad++ directory, but you may find it, %Appdata% directory )

    • In the section <Macros>, add the six lines below :

      <Macro name="VIRTUAL space, AFTER end of line, Activated" Ctrl="no" Alt="yes" Shift="no" Key="32">
          <Action type="0" message="2596" wParam="3" lParam="0" sParam="" />
      <Macro name="VIRTUAL space, AFTER end of line, Desactivated" Ctrl="no" Alt="yes" Shift="yes" Key="32">
          <Action type="0" message="2596" wParam="0" lParam="0" sParam="" />
    • Save the changes of "Shortcuts.xml" and restart Notepad++.

    • In macro menu, under the macro "Trim trailing and save", there are TWO new macros to set/unset the virtual space feature.

    When it's activated, you can place the cursor anywhere, in editor window ! That's quite nice :)

    ( Feel free to change the explicating text and/or the shortcuts of these two new macros ! )

    Important : Note that virtual space is enabled for all the files opened in a wiew, but you can set/unset the virtual space, independently, in the "main" view and the
    "secondary" view of N++.

    Enjoy our loved editor !



    Last edit: THEVENOT Guy 2013-04-29
    • GVC

      GVC - 2013-06-10

      Thanks Guy, for this explanation. Could it be this is NOT working for Windows7? I've tried your solution at home, where I still use WindowsXP and there the macros work. At the office, where I use Windows7, the same macros don't work.

      Both locations have NPP 6.3.3. installed.

      Best rgds,


    THEVENOT Guy - 2013-06-11

    Hello GVC,

    My notebook, at work, is a Hewlett Packard ProBook 6450b with a HD of 240 Go and 4 Go of RAM

    It runs under Windows 7 Entreprise SP1, with the processor Intel Core i3 M380 2.53 GHz

    My installed version of N++, on my work notebook, is 6.3.1, with a lot of plugins.

    I tested the same macros, concerning virtual space, this evening :

    I confirm that they do work on my W7 station :)

    I don't think the difference of versions ( 6.3.1 - 6.3.3 ), between you and me, causes this issue !

    For the time being, I have no idea why it doesn't work on your configuration ?

    Best Regards,


    PS :

    I forgot to tell you that I made a personal and local installation of N++ 6.3.1, without installer , in a folder, under 'My Documents'

    May be, that could explain the difference ?

    Last edit: THEVENOT Guy 2013-06-11

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

Sign up for the SourceForge newsletter:

No, thanks