Community
    • Login

    How to jump to the other end of selection?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 114 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • fml2F
      fml2
      last edited by

      Hello,

      if I select some text then I can extend the selection only one one end (where the insertion mark is). But what if I see that I’d like to extend the selection on its other end? Is it possible to move the cursor to the other end and keep the selection so that it gets extended there when I press e.g. Shift+Arrow?

      Thank you!

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @fml2
        last edited by

        @fml2 ,

        If I understand you correctly, you want something like the following:

        1. have text like abcdefghijklmnopqrstuvwxyz
        2. select nopq (shift and arrow keys, or what have you)
        3. move the caret back to the n
        4. select backward (shift and left arrow, for example) so you get jklm also selected in the same single selection

        Fortunately, even though Notepad++ cannot have default keyboard shortcuts on all of them, the underlying Scintilla library that Notepad++ uses for handling text selections and similar editing features has a lot of commands. I didn’t even think this one really existed, but when I searched their docs for swap, I found SCI_SWAPMAINANCHORCARET which does the magic of swapping the anchor (beginning of selection) and caret (end of selection), so you can actually do this.

        Go to Settings > Shortcut Mapper, and go to the Scintilla commands tab in that dialog. In the Filter: box, type SWAP, which will show you SCI_SWAPMAINANCHORCARET. Click on it, Modify, and assign a shortcut (for sake of my example, I am using Ctrl+Alt+Shift+Spacebar, which doesn’t conflict with anything else). Once you Apply and OK to close the dialogs, that shortcut will perform that action.

        Click between the m and n in the alphabet. Shift+RightArrow to select nopq. Use Ctrl+Alt+Shift+Spacebar , and notice that the selection stays the same, but the caret bar/symbol swaps to being before the n rather than after the q. Shift+LeftArrow four times to extend the selection to the left, so it’s now got jklmnopq, with the caret before the j. You can keep on using the new shortcut to swap, and go on extending to either end, to slowly add more and more of the alphabet, if you want. But if you were to Copy at this point, the clipboard would contain the jklmnopq as a single normal selection.

        It’s amazing how many hidden gems Notepad++ provides, either on its own or through the Scintilla library it uses. I personally never would have thought this sequence was a need I had, but it’s really cool that it’s available for those who do want it.

        fml2F 1 Reply Last reply Reply Quote 3
        • fml2F
          fml2 @PeterJones
          last edited by

          @PeterJones ,

          thank you for the description! A did it and it works like a charm! It is indeed amazing what’s possible with Notepad++! Likewise it’s also amazing what a friendly and helpful community it has!

          1 Reply Last reply Reply Quote 1
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors