• Login
Community
  • Login

Line select problem

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
9 Posts 7 Posters 1.5k 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.
  • M
    Michael Lander
    last edited by Jul 7, 2023, 3:39 AM

    If I click the area to the left of the line it selects the whole line, which is intended, but it also selects the start of the next line (for instance in this case, line 2) instead of stopping at the end of the selected line.

    Is there a way to change this behaviour?

    line select problem.gif

    E M P 3 Replies Last reply Jul 7, 2023, 6:28 AM Reply Quote 0
    • E
      Ekopalypse @Michael Lander
      last edited by Jul 7, 2023, 6:28 AM

      @Michael-Lander

      If the selected line should contain the line ends, you cannot do anything, because the cursor is always placed before the next position. But if you want to select the line without the line ends, then put the cursor at the beginning of the line and press Shift+end.

      1 Reply Last reply Reply Quote 3
      • G
        guy038
        last edited by guy038 Jul 7, 2023, 3:03 PM Jul 7, 2023, 2:42 PM

        Hello, @michael-lander, @ekopalypse and All,

        @michael-lander, you may be interested by my old post, below :

        https://community.notepad-plus-plus.org/post/52044

        Which contains some macros in order to cut/copy/paste text without the final EOL character(s) !

        Best Regards,

        guy038

        M 1 Reply Last reply Jul 8, 2023, 2:50 AM Reply Quote 4
        • M
          mkupper @Michael Lander
          last edited by Jul 7, 2023, 4:11 PM

          @Michael-Lander said in Line select problem:

          If I click the area to the left of the line it selects the whole line, which is intended, but it also selects the start of the next line (for instance in this case, line 2) instead of stopping at the end of the selected line.

          I experimented and it seems the current Notepad++ behavior is desirable in terms of what a person would normally do with the selected line or lines.

          If you want something that can select the entire line without the end-of-line character(s) then I would add a macro shortcut that does [End][Shift-Home][Shift-Home]. I assigned Ctrl-Shift-A to this and it seems to work well.

          I did the shift-home twice as Home goes to the start of the text and Home-Home goes to the start of the line.

          You could also do it as [Home][Home][Shift-End] which will leave the cursor at the end of the line as part of the process. The first version leaves the cursor at the start of the line

          Is there a way to change this behaviour?

          If you can demonstrate or show how the modified behavior would be useful then you could propose it as a new feature.

          Related to that is how would you want to activate it? At present Ctrl-click, Shift-click, right-click etc all seem to have useful and desired behavior when done in the left margin. I see that middle-click is available. I’m assuming that even if a preferences setting was added to make your desired behavior the default that at times you would want to activate the behavior that includes the end of line character(s) at times.

          T 1 Reply Last reply Jul 8, 2023, 5:40 AM Reply Quote 0
          • P
            PeterJones @Michael Lander
            last edited by Jul 7, 2023, 6:47 PM

            @Michael-Lander ,

            BTW: this has been discussed before.

            • https://community.notepad-plus-plus.org/topic/18086/how-to-limit-select-line-so-it-does-not-include-carriage-return-linefeed
            • https://community.notepad-plus-plus.org/topic/15859/copy-line-without-line-feed
            • and they even mention the Visual Studio Line Copy plugin, which also might do what you requested
            1 Reply Last reply Reply Quote 1
            • M
              Michael Lander @guy038
              last edited by Jul 8, 2023, 2:50 AM

              @guy038 this is great! I cannot, however, find any shortcuts.xml to drop them into.

              P 1 Reply Last reply Jul 8, 2023, 3:00 PM Reply Quote 0
              • T
                TBugReporter @mkupper
                last edited by TBugReporter Jul 8, 2023, 5:46 AM Jul 8, 2023, 5:40 AM

                @mkupper said in Line select problem:

                Home goes to the start of the text and Home-Home goes to the start of the line.

                Not always - if the cursor happens to already be at the start of the text on the line (and that happens to be a different position than the start of the line - IOW, if there is leading whitespace on the line), then the first Home will take it to the start of the line, and the second will bring it back to where it was originally. I would use [End][Home][Home][Shift-End] instead of just [Home][Home][Shift-End].

                A 1 Reply Last reply Jul 8, 2023, 11:03 AM Reply Quote 0
                • A
                  Alan Kilborn @TBugReporter
                  last edited by Alan Kilborn Jul 8, 2023, 11:03 AM Jul 8, 2023, 11:03 AM

                  @TBugReporter said in Line select problem:

                  I would use [End][Home][Home][Shift-End] instead of just [Home][Home][Shift-End].

                  The default key assignment of Alt+Home seems to always move the caret to column 1 of the current line. I haven’t done any digging, but I’m sure this has been discussed on this forum several times previously. Thus perhaps [Alt+Home][Shift+End] will suffice.

                  1 Reply Last reply Reply Quote 1
                  • P
                    PeterJones @Michael Lander
                    last edited by Jul 8, 2023, 3:00 PM

                    @Michael-Lander said in Line select problem:

                    @guy038 this is great! I cannot, however, find any shortcuts.xml to drop them into.

                    %AppData%\Notepad++\shortcuts.xml

                    See FAQ

                    1 Reply Last reply Reply Quote 0
                    • T Terry R referenced this topic on Jan 24, 2024, 9:42 PM
                    7 out of 9
                    • First post
                      7/9
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors