Community
    • 登入

    How can I mark multiples selected lines (to use with F2 after)

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    6 貼文 3 Posters 5.7k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • OverlordBRO
      OverlordBR
      最後由 編輯

      Hi!

      I want to select multiple lines (lines are in sequence)
      and, some how, mark them so

      Example:

      1 random text of line 1
      2 random text of line 2
      3 random text of line 3
      …
      N-1 random text of line N-1
      N random text of line N

      I want to select lines 2 to N - 1 and mark them
      so i can use F2 to navigate between them (or any other possible marker’s action)

      I can’t use the FIND\MARK line cause the text in the selected lines is random.

      Thanks in advance for any help!
      Sorry about my English (

      PeterJonesP 1 條回覆 最後回覆 回覆 引用 0
      • PeterJonesP
        PeterJones @OverlordBR
        最後由 編輯

        @OverlordBR ,

        I am not 100% sure I understand what you want, but I have a guess.

        My original thought was that you’d be able to just select all N lines with shift-and-arrows or dragging the mouse, then hitting Ctrl+F2 to bookmark, but that only bookmarks the last line in the selection.

        So instead,

        1. Select all N lines with shift-and-arrows or dragging the mouse
        2. Ctrl+M (or Search > Mark) to bring up the Mark dialog
        3. Fill out the Mark dialog:
          • Find what: \R
          • enable ☑ Bookmark line (this turns on bookmarking)
          • enable ☑ In Selection (the block should still be selected from step 1)
          • set Search Mode to ☑ Regular expression
          • click Mark All

        At this point, F2 (Next bookmark) should take you to the next bookmarked line

        If the last line of your selection happened to be the last line in the file, with no EOL sequence, that expression might miss the last line. You can either then manually bookmark that line (Ctrl+F2 or click in the bookmark column of the GUI), or you could change the expression to something like \R|^.*\Z …

        Alan KilbornA OverlordBRO 2 條回覆 最後回覆 回覆 引用 2
        • Alan KilbornA
          Alan Kilborn @PeterJones
          最後由 Alan Kilborn 編輯

          @PeterJones said in How can I mark multiples selected lines (to use with F2 after):

          to something like \R|^.*\Z …

          Or \R|.\z

          Interestingly, I noticed that with the above expression and a partial-line selection on the last line of the file, the character that gets marked (in red, because of the .) is the last character in the selection.

          Aside: Note that I used the single . because \z by itself won’t cause the bookmark to happen because the marking operation doesn’t register zero-length assertions.

          I do understand why this happens… ; with an In selection search, we have to be careful in our thinking about \z being strictly an “end-of-file” thing. In this case it is more of an “end-of-selection” thing. :-)

          BTW, the @PeterJones solution is one that cries out for a macro to be recorded for it, so that it appears as a nice command in the Macro menu and can optionally be tied to a keycombo for quick usage.

          OverlordBRO 1 條回覆 最後回覆 回覆 引用 2
          • Alan KilbornA
            Alan Kilborn
            最後由 Alan Kilborn 編輯

            A reference to a very similar topic is HERE.

            1 條回覆 最後回覆 回覆 引用 1
            • OverlordBRO
              OverlordBR @PeterJones
              最後由 編輯

              @PeterJones said in How can I mark multiples selected lines (to use with F2 after):

              \R

              YES… you nailed!
              I forgot about the mark + regular expression + \R stuff
              :)

              Thanks, Peter!

              1 條回覆 最後回覆 回覆 引用 2
              • OverlordBRO
                OverlordBR @Alan Kilborn
                最後由 編輯

                @Alan-Kilborn said in How can I mark multiples selected lines (to use with F2 after):

                BTW, the @PeterJones solution is one that cries out for a macro to be recorded for it, so that it appears as a nice command in the Macro menu and can optionally be tied to a keycombo for quick usage.

                Thanks for you extended explanation abou the problem, Alan!

                I will put both solutions on macros tu use with a key combo.

                1 條回覆 最後回覆 回覆 引用 2
                • 第一個貼文
                  最後的貼文
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors