Community
    • Login

    Selecting Text With the Use of the Ctrl + Shift + Up/ Down Combination

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    20 Posts 8 Posters 10.4k 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.
    • Влад КотенкоВ
      Влад Котенко
      last edited by Влад Котенко

      In the system’s default Notepad program (as well as in other word-processing applications), text can be selected up until the start/ end of a paragraph by pressing Ctrl + Shift + Up/ Down. When I do the same in Notepad++, the paragraph is moved upwards/ downwards instead of being selected. Does anyone know what needs to be changed in the settings so that Notepad++ may function in the same way as other word-processing applications when the Ctrl + Shift + Up/ Down combination is used?

      PeterJonesP José Luis Montero CastellanosJ 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Влад Котенко
        last edited by PeterJones

        @Влад-Котенко ,

        Every application chooses its own default keystrokes. Some word processors use those keystrokes, others don’t. Notepad++ is a text editor, and different text editors also have different keystrokes for certain tasks.

        In Notepad++'s case, the “select from here to end of paragraph” is Ctrl+Shift+] (given the ]/} key, you might think of it as Ctrl+Shift+}) – this is shown in Shortcut Mapper’s Scintlla Commands tab for SCI_PARADOWNEXTEND. The equivalent for “up / previous paragraph” is SCI_PARAUPEXTEND at Ctrl+Shift+[ (aka Ctrl+Shift+{).

        If you don’t like the default key combos, you can reassign them. (The current Ctrl+Shift+Up/Down are at Shorcut Mapper > Main > Move Up/Down Current Line, so you can assign those to something different (or to nothing), then change the SCI_PARAUPEXTEND/SCI_PARADOWNEXTEND to the keystrokes you want)

        Влад КотенкоВ 1 Reply Last reply Reply Quote 3
        • Влад КотенкоВ
          Влад Котенко @PeterJones
          last edited by

          Thank you for the explanation. I have assigned the key shortcuts according to your instructions.
          In the following example, when I put the cursor in the middle of the second paragraph and press Ctrl + Shift + Up to select the text up until the start of the second paragraph, the first paragraph is also selected. This does not happen in other word-editing applications. Is it possible to select only the text within the paragraph where the cursor is currently placed?
          652a28b4-9863-4ed7-8a0e-666a8a496eda-image.png

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Влад Котенко
            last edited by PeterJones

            @Влад-Котенко ,

            That’s because each “paragraph” that you show is only one line long – just a wrapped line. Shift+HOME (you might have to do it twice, depending on where on the wrapped line you are) will select to the beginning of the current line.

            In the example screenshots below, if you put the cursor in the indicated place on line 3, the SCI_PARAUPEXTEND will extend the selection to the beginning of line 1, because line 3 is only one line long:
            46ad09af-4b28-4ea4-91b3-7140c282e363-image.png

            But if you put it on line 6, then because the paragraph has multiple lines, the SCI_PARAUPEXTEND will go to the beginning of what you consider the current paragraph.
            e2d47c08-42f7-4302-a75f-fb9ce0424dcb-image.png

            So, if you are in situation like the line3 example, if you use your re-mapped Ctrl+Shift+Up and it goes too far, just use the Ctrl+Shift+Down immediately after, and it will reduce the selection by one paragraph, so it will be down to the selection you want:
            5b6275c7-1cd5-4968-884f-e372b292c8d5-image.png

            You said,

            (as well as in other word-processing applications)

            and later

            in other word-editing applications

            You keep comparing Notepad++ to word processors. Please understand, Notepad++ is a text editor, not a word processor, and focused on programming and other source-code editing (like for HTML/XML). It is more about lines of text, and less about paragraphs and formatting. It takes a slightly different mindset than tools like MS Word or LibreOffice Writer or Google Docs, because it is focused on a different task. It will never behave exactly like any word processor that you are used to, because it is a text editor, not a word processor.

            1 Reply Last reply Reply Quote 3
            • Влад КотенкоВ
              Влад Котенко
              last edited by

              Thank you for the explanations. It seems that there is no way to select paragraphs in Notepad++ in the same ways as in other programs. But the shortcuts which you have mentioned make it easier to select paragraphs.
              The system’s default Notepad is also a text-editing program, and paragraphs can be selected in it with the use of the Ctrl + Shift + Up/Down combination. This can also be done in various system windows where a user can type text. I thought that Notepad++ should function similarly.

              PeterJonesP Paul WormerP 3 Replies Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Влад Котенко
                last edited by PeterJones

                @Влад-Котенко ,

                This can also be done in various system windows where a user can type text. I thought that Notepad++ should function similarly.

                Every text editor and GUI application out there gets to make the call on how their product behaves under specific circumstances, and not all developers and users agree on what they best behavior is. Hence, in some cases, multiple applications come to the same decisions, but in other applications, different applications come to different decisions.

                If all applications behaved identically, there would be no reason for multiple products to exist in the same solution-space. But if that were the case, there would be a lot of unhappy users out there who couldn’t find a product that behaved in a way they found natural.

                1 Reply Last reply Reply Quote 1
                • Paul WormerP
                  Paul Wormer @Влад Котенко
                  last edited by Paul Wormer

                  @Влад-Котенко The behavior of shift+ctrl+up seems to be locally defined (I presume that you are in country where cyrillic is the standard script). In my Western-European setting neither Notepad nor MS-Word jumps to the end of the paragraph. My Notepad doesn’t do anything when I hit shift+ctrl+up and MS-Word creates a stream block from the current caret position to the beginning of the paragraph.

                  Alan KilbornA 1 Reply Last reply Reply Quote 0
                  • Alan KilbornA
                    Alan Kilborn @Paul Wormer
                    last edited by

                    @Paul-Wormer said in Selecting Text With the Use of the Ctrl + Shift + Up/ Down Combination:

                    My Notepad doesn’t do anything when I hit shift+ctrl+up

                    Earlier in the thread it was revealed that the default Notepad++ keycombo for the behavior under discussion is Shift+Ctrl+[.

                    Neil SchipperN 1 Reply Last reply Reply Quote 1
                    • José Luis Montero CastellanosJ
                      José Luis Montero Castellanos @Влад Котенко
                      last edited by José Luis Montero Castellanos

                      @Влад-Котенко
                      Have a good day:

                      Triple click with the left mouse button also has that function.

                      The idea of ​​some keyboard shortcuts is to minimize the time it takes to get your hand to the mouse and then back to the keyboard.

                      If it is to effectively avoid the use of the mouse for that single function, I haven’t said anything!.. :)

                      I wish you success.

                      1 Reply Last reply Reply Quote 2
                      • Neil SchipperN
                        Neil Schipper @Alan Kilborn
                        last edited by Neil Schipper

                        @Alan-Kilborn Paul’s point is that (old) Notepad.exe behaves differently from what Влад described, and speculates that the difference may be related to the language in effect.

                        This is actually kind of interesting (assuming Влад correctly described their observation) since, who would expect a nifty navigation (actually, text selection) feature in good old (old, old) Notepad to be available with some languages in effect but not the super-ubiquitous Western?

                        Alan KilbornA Paul WormerP 2 Replies Last reply Reply Quote 2
                        • Alan KilbornA
                          Alan Kilborn @Neil Schipper
                          last edited by

                          @Neil-Schipper said in Selecting Text With the Use of the Ctrl + Shift + Up/ Down Combination:

                          Paul’s point is that (old) Notepad.exe behaves differently…

                          Ah, OK. I’m so used to people referring to N++ as “notepad” that I read what Paul wrote wrongly. I try to always write “notepad.exe” (like you did) when referring to Windows’ poor excuse for a text editor.

                          1 Reply Last reply Reply Quote 2
                          • Paul WormerP
                            Paul Wormer @Neil Schipper
                            last edited by

                            @Neil-Schipper You summarized my point nicely and exactly.

                            In addition I like to pose the question to Влад: how do you recognize a paragraph boundary, either in notepad.exe or in Npp? Is it twice a CRLF, or one CRLF followed by, say, 3 spaces? It is of course not <p> or </p> as in HTML, or \par as in LaTeX.

                            1 Reply Last reply Reply Quote 0
                            • PeterJonesP
                              PeterJones @Влад Котенко
                              last edited by PeterJones

                              @Влад-Котенко said in Selecting Text With the Use of the Ctrl + Shift + Up/ Down Combination:

                              The system’s default Notepad is also a text-editing program, and paragraphs can be selected in it with the use of the Ctrl + Shift + Up/Down combination

                              Interestingly, in my Windows 10 notepad.exe at work, Ctrl+Shift+Up/Down and Ctrl+Up/Down do nothing. But when I was playing around last night at home on Windows 11, notepad.exe does respond to those combinations, similar to what you described… but not exactly. In that, what you called “start of paragraph” was always “start of current line”. If you have notepad.exe’s Word Wrap turned on, then one physical line (which wraps over multiple visible lines with Word Wrap on) would behave as you describe; but if I made a document of

                              one example one example one example one example one example one example | one example one example one example one example
                              
                              two example two example two example two example two example two example two example | two example 
                              
                              three example will have a manual linebreak here
                              and continues through the cursor | here
                              

                              … and put the caret at the | in two example, the Ctrl+Shift+Up would take you to the beginning of line starting with two. Similarly, if you put it in the | of cursor | here, it would take you to the beginning of and continues, not to the beginning of three example.

                              So based on that, I think that “physical line that contains line wrap” is your definition of “paragraph”. So in Notepad++, running Shift+Home+Home (hold down shift, and hit Home twice) will select to the beginning of the current line from wherever you are in the wrapped line that you call a “paragraph”.

                              PeterJonesP 1 Reply Last reply Reply Quote 0
                              • PeterJonesP
                                PeterJones @PeterJones
                                last edited by PeterJones

                                All,

                                BTW, I hadn’t yet mentioned: I started a conversation with the Scintilla maintainers. (For those who don’t know, Scintilla is the name of the library that Notepad++ uses for handling things in the editor tab, including the moving the caret around and the Paragraph Up/Down commands and similar; so they are the ones who decide whether any behavior of the Paragraph Up/Down is a “bug” or not.)

                                Scintilla’s definition of “Paragraph Up” is “move the caret up one physical line, then skip any blank lines, then keep going up while the current line is still non-empty”.

                                This means, in my original picture

                                … if you are on line 6, it will move back to line 5 and then stop, because line 4 is empty so it doesn’t move up to 4. But if you are anywhere on 3 (whether in the first visible line because of wrap or second visible line of wrap or whether wrap is off), it will go up one line first (to 2) then skip the blank line 2, and keep going up until it’s the top line of a group of non-empty lines (so goes up to the beginning of 1).

                                The implication of the way the Scintilla library maintainer phrased his replies is that “Scintilla has been doing it this same way for years, and I’m not going to change it just because someone started complaining about it now.” So, unfortunately, the Scintilla library doesn’t look like it’s going to update that behavior. And since Notepad++ is not going to abandon Scintilla and “roll its own” for all the features that library implements, there is little-to-no chance that the paragraph-up behavior will change in Notepad++. Sorry.

                                But like I said earlier, if all of your “paragraphs” are really one long line with word-wrap turned on, then you can use the select-to-beginning-of-line sequence instead of select-paragraph-up, and that will work as expected wherever you are in your paragraph.

                                If your paragraphs are “mixed” (if you have multiple physical lines in one paragraph, but also have long lines wrapped), you can use the sequence of “select to beginning of line” first, then if it hasn’t selected to the top of what you consider the paragraph, use select-paragraph-up to get to the top of the multi-line paragraph. (So, from line 6’s |, the first would take you to the beginning of line 6, and the second would get you to the beginning of line 5.)

                                PeterJonesP 1 Reply Last reply Reply Quote 2
                                • Alan KilbornA
                                  Alan Kilborn
                                  last edited by Alan Kilborn

                                  So we can fix the “bad” Scintilla behavior with a little scripting. I think the following works to fix the “paragraph up extend” functionality. If anybody wants to try it, some instructions for setting up and running a script are HERE.

                                  # -*- coding: utf-8 -*-
                                  from __future__ import print_function
                                  
                                  # references:
                                  #  https://community.notepad-plus-plus.org/topic/23737
                                  #  https://sourceforge.net/p/scintilla/bugs/2363/
                                  
                                  from Npp import *
                                  import re
                                  
                                  #-------------------------------------------------------------------------------
                                  
                                  class T23737(object):
                                  
                                      def __init__(self):
                                          if editor.getSelections() > 1: return  # conditions not correct for running this script
                                          sel_mode = editor.getSelectionMode()
                                          rect_sel_mode = True if (sel_mode == SELECTIONMODE.RECTANGLE or sel_mode == SELECTIONMODE.THIN) else False
                                          if rect_sel_mode: return  # conditions not correct for running this script
                                          #self.para_up()
                                          self.para_up_extend()
                                  
                                      def para_up(self):
                                          self.internal_para_up(False)
                                  
                                      def para_up_extend(self):
                                          self.internal_para_up(True)
                                  
                                      def is_white_line(self, line_num):
                                          return False if re.search(r'[^\t ]', editor.getLine(line_num).rstrip('\n\r')) else True
                                  
                                      def internal_para_up(self, extend_sel):
                                          curr_anchor, curr_pos = editor.getAnchor(), editor.getCurrentPos()
                                          line_num = editor.lineFromPosition(curr_pos)
                                          line_start_pos = editor.positionFromLine(line_num)
                                          if curr_pos == line_start_pos or self.is_white_line(line_num):
                                              line_num -= 1
                                              while line_num >= 0 and self.is_white_line(line_num): line_num -= 1  # skip empty lines
                                          while line_num >= 0 and not self.is_white_line(line_num): line_num -= 1  # skip non-empty lines
                                          line_start_pos = editor.positionFromLine(line_num + 1)
                                          editor.setSel(curr_anchor if extend_sel else line_start_pos, line_start_pos)  # arguments: anchor, caret
                                  
                                  #-------------------------------------------------------------------------------
                                  
                                  if __name__ == '__main__': T23737()
                                  

                                  Edit: minor tweaks to script after original post!

                                  Влад КотенкоВ 1 Reply Last reply Reply Quote 2
                                  • Alan KilbornA Alan Kilborn referenced this topic on
                                  • Влад КотенкоВ
                                    Влад Котенко @Alan Kilborn
                                    last edited by

                                    quotation: “The behavior of shift+ctrl+up seems to be locally defined (I presume that you are in country where cyrillic is the standard script). In my Western-European setting neither Notepad nor MS-Word jumps to the end of the paragraph. My Notepad doesn’t do anything when I hit shift+ctrl+up and MS-Word creates a stream block from the current caret position to the beginning of the paragraph.”
                                    The US version of Windows 11 is installed on my computer, and the primary keyboard language and layout are US English. I think that the Ctrl + Shift + Up/ Down shortcut functions in the same way in other versions. I did not know that it may function differently on some computers.
                                    quotation: “Have a good day:
                                    Triple click with the left mouse button also has that function.
                                    The idea of some keyboard shortcuts is to minimize the time it takes to get your hand to the mouse and then back to the keyboard.
                                    If it is to effectively avoid the use of the mouse for that single function, I haven’t said anything!.. :)
                                    I wish you success.”

                                    Yes, a triple click is a convenient way to make a selection quickly when one’s hand is currently on the mouse.
                                    But when the hands are on the keyboard, a shortcut is convenient.
                                    quotation: “In addition I like to pose the question to Влад: how do you recognize a paragraph boundary, either in notepad.exe or in Npp? Is it twice a CRLF, or one CRLF followed by, say, 3 spaces? It is of course not <p> or </p> as in HTML, or \par as in LaTeX.”
                                    I view a paragraph as a block of text which is preceded by a break at the beginning and followed by a break at the end. A paragraph occupies more than one line if the word wrap option is enabled. A break is made by pressing the Enter key.
                                    quotation: “So based on that, I think that “physical line that contains line wrap” is your definition of “paragraph”.”
                                    Yes, that is how I view paragraphs. The word wrap option is always enabled in my text-editing programs.
                                    quotation: “Scintilla’s definition of “Paragraph Up” is “move the caret up one physical line, then skip any blank lines, then keep going up while the current line is still non-empty”.
                                    …
                                    The implication of the way the Scintilla library maintainer phrased his replies is that “Scintilla has been doing it this same way for years, and I’m not going to change it just because someone started complaining about it now.” So, unfortunately, the Scintilla library doesn’t look like it’s going to update that behavior. And since Notepad++ is not going to abandon Scintilla and “roll its own” for all the features that library implements, there is little-to-no chance that the paragraph-up behavior will change in Notepad++. Sorry.”

                                    Thank you for the explanation. I will have to get accustomed to the different functioning of Notepad++.
                                    quotation: “So we can fix the “bad” Scintilla behavior with a little scripting. I think the following works to fix the “paragraph up extend” functionality. If anybody wants to try it, some instructions for setting up and running a script are HERE.”
                                    Thank you for writing the script. Since I have never added a piece of code, I will find out how to do this in order to use the script.

                                    1 Reply Last reply Reply Quote 0
                                    • PeterJonesP
                                      PeterJones @PeterJones
                                      last edited by

                                      @PeterJones said in Selecting Text With the Use of the Ctrl + Shift + Up/ Down Combination:

                                      I started a conversation with the Scintilla maintainers.
                                      Scintilla’s definition of “Paragraph Up” [was] “move the caret up one physical line, then skip any blank lines, then keep going up while the current line is still non-empty”.

                                      The good news is, they accepted it. Scintilla v5.3.2 uses the adjusted definition, so it won’t do the initial line-up under most circumstances: The new phrasing could be

                                      Scintilla’s definition of “Paragraph Up” is “if the caret is at the start of the line then move the caret up one physical line, then no matter what skip any blank lines going up, then keep going up while the current line is still non-empty”.

                                      Влад Котенко 2В Michael VincentM 2 Replies Last reply Reply Quote 2
                                      • Влад Котенко 2В
                                        Влад Котенко 2 @PeterJones
                                        last edited by

                                        @PeterJones said in Selecting Text With the Use of the Ctrl + Shift + Up/ Down Combination:

                                        @PeterJones said in Selecting Text With the Use of the Ctrl + Shift + Up/ Down Combination:

                                        I started a conversation with the Scintilla maintainers.
                                        Scintilla’s definition of “Paragraph Up” [was] “move the caret up one physical line, then skip any blank lines, then keep going up while the current line is still non-empty”.

                                        The good news is, they accepted it. Scintilla v5.3.2 uses the adjusted definition, so it won’t do the initial line-up under most circumstances: The new phrasing could be

                                        Scintilla’s definition of “Paragraph Up” is “if the caret is at the start of the line then move the caret up one physical line, then no matter what skip any blank lines going up, then keep going up while the current line is still non-empty”.

                                        Thank you for the update. I guess that it may take some time before any improvements in the functionality of the program are made.

                                        1 Reply Last reply Reply Quote 0
                                        • Michael VincentM
                                          Michael Vincent @PeterJones
                                          last edited by

                                          @PeterJones said in Selecting Text With the Use of the Ctrl + Shift + Up/ Down Combination:

                                          The good news is, they accepted it. Scintilla v5.3.2 uses the adjusted definition

                                          The “better” news – Notepad++ may be upgrading soon again …

                                          Cheers.

                                          Michael VincentM 1 Reply Last reply Reply Quote 3
                                          • Michael VincentM
                                            Michael Vincent @Michael Vincent
                                            last edited by

                                            @Michael-Vincent said in Selecting Text With the Use of the Ctrl + Shift + Up/ Down Combination:

                                            The “better” news – Notepad++ may be upgrading soon again …

                                            @PeterJones
                                            @Влад-Котенко-0

                                            The “best” news - it will be in the next release. I downloaded the artifact and it seems to work as intended!

                                            Cheers.

                                            1 Reply Last reply Reply Quote 4
                                            • First post
                                              Last post
                                            The Community of users of the Notepad++ text editor.
                                            Powered by NodeBB | Contributors