Need a setting to treat visible lines as "physical" ones.



  • Good day,
    I use Notepad++ for text editing, and the default view is “wrap text”.
    Very often the sentence is wrapped into several lines.
    Navigating such a sentence using Home and End keys is not similar to MS Word, where a chunk of wrapped long sentence is regarded as a separate line, in Notepad++ pressing End key takes me to the very end of the sentence or even paragraph while I needed to get to the right edge of the workspace.

    Have I overlooked a setting which switches on the behavior I need?

    Thank you.



  • @Aleksandr-Okunev

    I haven’t had a need recently, but I think mapping some of these in the Shortcut Mapper can provide the needed functionality:

    399a44be-579f-48dd-8094-22bbbe23930d-image.png



  • @Aleksandr-Okunev ,

    I am a bit confused. The default behavior of the END key (using SCI_LINEENDWRAP in Shortcut Mapper > Scintilla Commands) will take you to the end of the visible line the first time you hit END; the second time you hit END, it goes to the end of the wrapped line.

    Based on my understanding, you want the END key to take you to the end of the visible line, which it will.

    Unless I’ve misunderstood you.

    But as @Alan-Kilborn said, there are lots of variants of the Scintilla commands, and you can change the keyboard mapping, so you can make the keys do what you want. The Scintilla Docs will explain the technicalities of each of those SCI_... names.



  • Thanks everyone for your responses.

    Yes I posted misleading data.

    My problem is with Shift+Home and Shift+End, which I use to select the text.

    If I place the cursor in the middle of the “visible” line which is a part of a sentence which makes several “visible” lines, and my intended selection ends at the end of the current visible line, when I hold Shift and press End, the entire “physical” line is selected, up to the hard return, and not my intended selection.

    Same with Shift+Home, instead of selecting text up to the left edge of the work space, the editor selects several “visible” lines up to the previous hard return.



  • @Aleksandr-Okunev

    Well, my current setup works exactly as you describe you want yours to.
    And trying a “fresh” Notepad++, that’s exactly how it works as well.

    So if you need further help on this, I’d suggest you show a screenshot of the area of the Shortcut Mapper I showed previously, but include the area to the right – the actual keybindings – for your setup, which mine does not show.



  • Hello, @aleksandr-okunev, @Peterjones, @Alan-kilborn and All,

    @aleksandr-okunev, as you’re mainly using the Word wrap mode, I suppose that you would like commands which move to the very beginning and to the very end of current line

    Here is a table which recapitulates all Scintilla actions relating to beginning and end of current line :

    •---------------------------------------------------------------------------------------------------------------------------------------------------------•
    |                         Different SCINTILLA messages about NAVIGATION, NORMAL and RECTANGULAR selection within CURRENT line                             |
    •------•----------------------------•--------•----------------------•-------------------------------------------------------------------------------------•
    | Num. |     SCINTILLA message      |   Id.  |   DEFAULT shortcut   |                           ACTION of the SCINTILLA message                           |
    •------•----------------------------•--------•----------------------•-------------------------------------------------------------------------------------•
    |  51  |  SCI_HOME                  |  2312  |                      |  Start of DOCUMENT line                                                             |
    |  52  |  SCI_HOMEEXTEND            |  2313  |                      |  STREAM selection      to start of DOCUMENT line                                    |
    |  53  |  SCI_HOMERECTEXTEND        |  2430  |                      |  RECTANGULAR selection to start of DOCUMENT line                                    |
    |      |                            |        |                      |                                                                                     |
    |  58  |  SCI_VCHOME                |  2331  |                      |  Start of first NON-BLANK char <-> Start of DOCUMENT line                           |
    |  xx  |  SCI_VCHOMEEXTEND          |  2332  |     NOT LISTED       |  STREAM selection to ...                                                            |
    |      |                            |        |                      |                                                                                     |
    |  56  |  SCI_HOMEWRAP              |  2349  |                      |  Start of DISPLAY line -> Start of DOCUMENT line                                    |
    |  57  |  SCI_HOMEWRAPEXTEND        |  2450  |                      |  STREAM selection to ...                                                            |
    |      |                            |        |                      |                                                                                     |
    |  61  |  SCI_VCHOMEWRAP            |  2453  |  Home                |  Start of DISPLAY line -> First NON-BLANK char <-> Start of DOCUMENT line           |
    |  59  |  SCI_VCHOMEWRAPEXTEND      |  2454  |  Shift + Home        |  STREAM selection to ...                                                            |
    |  60  |  SCI_VCHOMERECTEXTEND      |  2431  |  Alt + Shift + Home  |  RECTANGULAR selection to ...                                                       |
    |      |                            |        |                      |                                                                                     |
    |  54  |  SCI_HOMEDISPLAY           |  2345  |  Alt + Home          |  Start of DISPLAY line                                                              |
    |  55  |  SCI_HOMEDISPLAYEXTEND     |  2346  |                      |  STREAM selection to start of DISPLAY line                                          |
    |      |                            |        |                      |                                                                                     |
    |  xx  |  SCI_VCHOMEDISPLAY         |  2652  |     NOT LISTED       |  Start of DISPLAY line OR start of first NON-BLANK char <-> Start of DOCUMENT line  |
    |  xx  |  SCI_VCHOMEDISPLAYEXTEND   |  2653  |     NOT LISTED       |  STREAM selection to ...                                                            |
    •------•----------------------------•--------•----------------------•-------------------------------------------------------------------------------------•
    |  62  |  SCI_LINEEND               |  2314  |                      |  End of DOCUMENT line                                                               |
    |  68  |  SCI_LINEENDEXTEND         |  2315  |                      |  STREAM selection      to end of DOCUMENT line                                      |
    |  64  |  SCI_LINEENDRECTEXTEND     |  2432  |  Alt + Shift + End   |  RECTANGULAR selection to end of DOCUMENT line                                      |
    |      |                            |        |                      |                                                                                     |
    |  67  |  SCI_LINEENDWRAP           |  2451  |  End                 |  End of DISPLAY line -> End of DOCUMENT line                                        |
    |  63  |  SCI_LINEENDWRAPEXTEND     |  2452  |  Shift + End         |  STREAM selection to ...                                                            |
    |      |                            |        |                      |                                                                                     |
    |  65  |  SCI_LINEENDDISPLAY        |  2347  |  Alt + End           |  End of DISPLAY line                                                                |
    |  66  |  SCI_LINEENDDISPLAYEXTEND  |  2348  |                      |  STREAM selection to end of DISPLAY line                                            |
    •------•----------------------------•--------•----------------------•-------------------------------------------------------------------------------------•
    

    For additional information, refer to :

    https://www.scintilla.org/ScintillaDoc.html#KeyboardCommands


    Notes :

    • In case a wrapped line, the Scintilla documentation speak of :

      • Display line, to name each line of this wrapped line

      • Document line, to name the wrapped line, itself

    • Personally, I prefer to speak of physical lines for each line and of logical line to refer to the wrapped line, itself. Just my preference ;-)

    • In the table, above, 3 Scintilla commands are not listed in the Scintilla Commands tab of the N++ Shortcut Mapper. So they cannot be stored as Scintilla commands in your active Shortcut.xml file. Luckily, you can define these messages in a new Macro, located in the <Macros> node, then assign the appropriate shortcuts to each macro !

            <Macro name="SCI_VCHOMEEXTEND" Ctrl="yes/no" Alt="yes/no" Shift="yes/no" Key="0">
                <Action type="0" message="2332" wParam="0"  lParam="0"  sParam="" />
            </Macro>
    
            <Macro name="SCI_VCHOMEDISPLAY" Ctrl="yes/no" Alt="yes/no" Shift="yes/no" Key="0">
                <Action type="0" message="2652" wParam="0"  lParam="0"  sParam="" />
            </Macro>
    
            <Macro name="SCI_VCHOMEDISPLAYEXTEND" Ctrl="yes/no" Alt="yes/no" Shift="yes/no" Key="0">
                <Action type="0" message="2653" wParam="0"  lParam="0"  sParam="" />
            </Macro>
    

    So, from this table, @aleksandr-okunev, here is the road map of the actions to do in the Scintilla commands tab of the Shortcut Mapper

    • Delete the shortcut of line 61 and assign the Home shortcut to line 51

    • Delete the shortcut of line 59 and assign the Shift + Home shortcut to line 52

    • Delete the shortcut of line 60 and assign the Alt + Shift + Home shortcut to line 53

    • Delete the shortcut of line 67 and assign the End shortcut to line 62

    • Delete the shortcut of line 63 and assign the Shift + End shortcut to line 68

    Hope this helps !

    Best Regards,

    guy038



  • Thanks everyone.
    I use a very old version.
    I will upgrade and come back with the results.
    Stay safe and have fun! :-)



  • I upgraded from version 5.x to the latest version (I wish the best of luck to HK people, and doom to evil commies), and the text selection is indeed exactly what I need and exactly as it is in MS Word.
    Thanks a lot, everyone, stay safe and have a great weekend.
    :^)