Community
    • Login

    Advance cursor past any sequence of non-blank characters and following blank, tab, or newlines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 4 Posters 488 Views 2 Watching
    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.
    • Russ JonesR Offline
      Russ Jones
      last edited by

      Is there any way to advance the cursor to the next “word” where “word” means any non-blank characters delimited by spaces, tabs, or newlines? The definition of “word” in NotePad treats every punctuation character as a word, which I find mostly unhelpful. For example,
      142
      is treated as a word but
      -142
      is treated as two words.
      abc
      is treated as one word but
      “abc”
      is treated as 3 words. This definition of a word when using CTRL-rightarrow to advance through the text is no doubt useful in some contexts, but often inhibits defining effective keyboard macros to advance through the blank-separated fields of a table, because where the cursor stops depends on the field contents.

      I would like to be able to advance through the current sequence of nonblank characters and whatever whitespace follows, and land on the next non-blank character after that. Is this possible? Is there a keyboard shortcut that does that?

      FreeMeowF 1 Reply Last reply Reply Quote 0
      • FreeMeowF Offline
        FreeMeow @Russ Jones
        last edited by

        @Russ-Jones found another post about the same subject that seem to have the answer
        https://community.notepad-plus-plus.org/topic/24248/ctrl-l-r-arrow-keys-distance-modification

        I tried what guy038 proposed and used the characters you gave: - and " ( how do you make the text have the nice red color people use when giving characters? ), and with your examples it does what you want.

        1 Reply Last reply Reply Quote 1
        • guy038G Online
          guy038
          last edited by guy038

          Hello, @russ-jones, @freemeow and All,

          I think, @russ-jones, that we can simulate these behaviors that you’re longing for, with macros !

          Add in your active Shortcuts.xml, in the macros node, this section, below :

                  <Macro name="End Previous NON-Blank chars" Ctrl="no" Alt="yes" Shift="no" Key="190">
                      <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                      <Action type="3" message="1601" wParam="0" lParam="0" sParam="\S+\K(?=\s)" />
                      <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                      <Action type="3" message="1602" wParam="0" lParam="0" sParam="" />
                      <Action type="3" message="1702" wParam="0" lParam="256" sParam="" />
                      <Action type="3" message="1701" wParam="0" lParam="1" sParam="" />
                  </Macro>
                  <Macro name="End Next NON-Blank chars" Ctrl="no" Alt="yes" Shift="no" Key="191">
                      <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                      <Action type="3" message="1601" wParam="0" lParam="0" sParam="\S+\K(?=\s)" />
                      <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                      <Action type="3" message="1602" wParam="0" lParam="0" sParam="" />
                      <Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
                      <Action type="3" message="1701" wParam="0" lParam="1" sParam="" />
                  </Macro>
          

          As, you’re probably an American or English person, I chose, on purpose, the shortcuts Alt + < and Alt + >, near the spacebar key, for these two macros !

          They move the caret/cursor to the END of the Previous/Next NON-Blank characters. Unfortunately, you’ll always get the additional message ^ zero length match

          I hope you’ll be happy with this solution !

          Best Regards,

          guy038

          P.S. :

          Here are ALL the positions | where the caret stops within the last change.log file :

          Notepad++| v8.9.1| regression| fixes,| bug-fixes| &| new| improvements:|
          
           1.| Fix| EOL| duplication| regression| when| playing| back| old| recorded| macros.|
           2.| Remedy| search| failure| for| pasted| text| containing| trailing| invisible| EOL| character.|
           3.| Fix| customized| context| menu| regression| where| separator| (id="0")| escapes| FolderName| submenu.|
           4.| Fix| issue| where| a| single| undo| reverted| multiple| changes| after| macro| execution.|
           5.| Fix| visual| glitch| when| dragging| dockable| dialogs| on| a| 2nd| monitor.|
           6.| Fix| inconsistent| automatic| search| mode| switching| (RegEx| to| Extended)| in| Find| dialog.|
           7.| Fix| incorrect| URL| parsing| caused| by| Unicode| special| spaces.|
           8.| Update| to| Boost| 1.90.0.|
           9.| Improve| update| themes| feature:| fix| JavaScript.js| edge| case.|
          10.| Update| javascript.js| to| better| match| javascript| (embedded)| in| all| themes.|
          11.| Function| List:| enhance| for| Perl| &| PHP;| add| for| Nim.|
          12.| Fix| comments| and| highlighting| in| TCL.|
          13.| Update| perl| keywords| and| autocomplete| for| 5.42.|
          14.| Improvement:| display| Find| dialog| status| message| with| invisible| characters| warning.|
          
          
          
          Get| more| info| on|
          https://notepad-plus-plus.org/downloads/v8.9.1/|
          
          
          Included| plugins:|
          
           1.|  NppExport| v0.4|
           2.|  Converter| v4.7|
           3.|  Mime| Tool| v3.1|
          
          
          Updater| (Installer| only):|
          
          *| WinGUp| (for| Notepad++)| v5.3.9|
          

          IMPORTANT :

          You cannot go backward, with the Alt + < shortcut, if the caret is, presently, at the very beginning of any line , but you still can go forward, with the Alt + > shortcut, then go backward, again, if necessary !

          M Andre Z EckenrodeM 1 Reply Last reply Reply Quote 1
          • M Andre Z EckenrodeM Offline
            M Andre Z Eckenrode @guy038
            last edited by

            @guy038 said in Advance cursor past any sequence of non-blank characters and following blank, tab, or newlines:

            Unfortunately, you’ll always get the additional message ^ zero length match

            You should be able to immediately dismiss that message by issuing a final keystroke of ESC at the end of the macro. That works for a macro I recently created, which moves the cursor to the next position following two line breaks (next paragraph, for my purposes).

            1 Reply Last reply Reply Quote 3
            • guy038G Online
              guy038
              last edited by guy038

              Hi, , @russ-jones, @freemeow, @m-andre-z-eckenrode and All,

              Ah… many thanks, @m-andre-z-eckenrode for your valuable input ! Thus, @russ-jones, my macros can be improved as below, just adding a final Esc key stroke :

                      <Macro name="End Previous NON-Blank chars" Ctrl="no" Alt="yes" Shift="no" Key="190">
                          <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                          <Action type="3" message="1601" wParam="0" lParam="0" sParam="\S+\K(?=\s)" />
                          <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                          <Action type="3" message="1602" wParam="0" lParam="0" sParam="" />
                          <Action type="3" message="1702" wParam="0" lParam="256" sParam="" />
                          <Action type="3" message="1701" wParam="0" lParam="1" sParam="" />
                          <Action type="0" message="2325" wParam="0" lParam="0" sParam="" />
                      </Macro>
                      <Macro name="End Next NON-Blank chars" Ctrl="no" Alt="yes" Shift="no" Key="191">
                          <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                          <Action type="3" message="1601" wParam="0" lParam="0" sParam="\S+\K(?=\s)" />
                          <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                          <Action type="3" message="1602" wParam="0" lParam="0" sParam="" />
                          <Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
                          <Action type="3" message="1701" wParam="0" lParam="1" sParam="" />
                          <Action type="0" message="2325" wParam="0" lParam="0" sParam="" />
                      </Macro>
              

              BR

              guy038

              1 Reply Last reply Reply Quote 2

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors