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



  • 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?



  • 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 :-/



  • 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 :)



  • 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?



  • 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.



  • 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).



  • 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



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


Log in to reply