• Login
Community
  • Login

Mark text from cursor's position to the start of line (Shift+Home) while Word Wrap is enabled

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
word wraphotkey
8 Posts 5 Posters 6.2k 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.
  • O
    Oliver Dambroth
    last edited by Oct 9, 2015, 10:00 AM

    With View > Word Wrap enabled, pressing “Shift + Home” while in the second, third, … line of a word-wrapped paragraph always marks all text from the cursors position to the beginning of the paragraph. However, I only want to mark the text from the cursor’s position to the start of the line the cursor is in (pretty much the way pressing “Home” without Shift works). Any ideas?

    1 Reply Last reply Reply Quote 0
    • D
      dail
      last edited by Oct 9, 2015, 2:05 PM

      This issue has been reported here . I even created a pull request to fix it here . No idea if it will ever be merged though :-/

      1 Reply Last reply Reply Quote 1
      • O
        Oliver Dambroth
        last edited by Oct 9, 2015, 2:19 PM

        Hm, reported almost 4 months ago… so there’s little hope it gets fixed anytime soon :/ I recently installed Notepad++ as an alternative to TextPad, but found it still lacks some polishing here and there. Anyway, thank you :)

        1 Reply Last reply Reply Quote 0
        • E
          Eduardo Borges
          last edited by Oct 9, 2015, 6:30 PM

          IMHO, Notepad++ is behaving fine and should not be improved in that respect. Lines in code writing are taken care of as logical units. When you position within a line and Shift+Home/End, it marks to the beginning/end of the Logical Line (CR/LF), not the begining of what is being displayed, something which can vary depending on window adjustments, wrap/no wrap. For Notepad++, that is rather a single line wraped for editing convenience. Well, maybe it would be also convenient to Mark to the end/beginning of the line “as viewed”, sigh… Maybe a configurable feature would make everyone happier?

          1 Reply Last reply Reply Quote 0
          • S
            Scott Sumner
            last edited by Oct 9, 2015, 7:57 PM

            I think Eduardo was 100% right until I read his last 2 sentences. There are sooo many real concerns to address with NPP, and people bring up stuff like this. I’m not picking on NPP (happen to like, almost love, it), and I’m not trying to offend anyone, including the OP.

            1 Reply Last reply Reply Quote 0
            • O
              Oliver Dambroth
              last edited by Oct 10, 2015, 12:26 AM

              I have to disagree, Eduardo. The behavior is not fine, it is inconsistent and counterintuitive: Pressing “Home” without holding “Shift” actually moves the cursor to the beginning of “what is being displayed”. Pressing it a second time then moves it to the beginning of the whole line (or paragraph).

              1 Reply Last reply Reply Quote 0
              • G
                guy038
                last edited by guy038 Oct 11, 2015, 5:14 PM Oct 11, 2015, 3:01 PM

                Hi Oliver, dail, Eduardo,Scott and All

                I think I’ve got a nice solution, which will satisfy all of you. Indeed ! No need to change N++ source code at all :-) I already replied, for that topic, on SourceForge forums, on June 2013 :

                http://sourceforge.net/p/notepad-plus/discussion/331753/thread/d3e0ab6d/#ddf6

                Actually, when text is wrapped, because of long lines and/or if the the N++ window is smaller that the entire screen, by default :

                • The Scintilla shortcut SHIFT + End selects from the cursor position to the end of the entire line.

                • The Scintilla shortcut SHIFT + Home selects from the cursor position to the first non space character, at beginning of line. If you type, again, SHIFT + Home, then selection goes to the very beginning of the line.

                If you prefer to extend selection to the beginning or the end of the physical line, where the cursor is, you just have to modify these TWO shortcuts, in the Shortcut Mapper ( Menu Settings - Shortcut Mapper… - Scintilla commands ).

                So :

                • Delete the default shorcuts, at lines 59 ( SCI_VCHOMEXTEND ) and 64 ( SCI_LINEENDEXTEND ), in the Scintilla commands tab of the Shortcut Mapper, by setting the key None.

                • Set the shortcut SHIFT + Home to the entry, at line 62 ( SCI_VCHOMEWRAPEXTEND ) and the shortcut SHIFT + End to the entry, at line 69 ( SCI_LINEENDWRAPEXTEND )


                The VERY NICE thing, with these new shortcuts, is that a SECOND hit, on these shortcuts, allows you to reach the very beginning/end of the wrapped paragraph, as the default N++ behaviour does. However, a THIRD hit ( SHIFT + HOME ) is, sometimes, necessary to get the very beginning of a line, when this line begins with some blank characters :-)

                Tested with N++, v6.8.1. You don’t even need to restart N++, to appreciate this new N++ extension of selection !

                Enjoy that change !

                Best Regards,

                guy038

                1 Reply Last reply Reply Quote 1
                • O
                  Oliver Dambroth
                  last edited by Oct 11, 2015, 5:38 PM

                  Yes, it works! Thank you very much for this solution, guy038! :)

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