• Login
Community
  • Login

Keyboard shortcut to select current line to complement triple click

Scheduled Pinned Locked Moved General Discussion
7 Posts 4 Posters 1.8k 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.
  • S
    Stefan Ozminski
    last edited by Jan 24, 2024, 9:23 PM

    I searched the web (and Settings ->Shortcut Mapper) for a Notepad++ keyboard shortcut to select the current line, and the closest I found was Ctrl-I, which is the Split Lines shortcut. Ctrl-I selects the current line if there are multiple vertical edges defined, when I expected the lines to split at the vertical edge with the smallest column number. For the sake of operations like Convert Case, and as a complement to triple click, I think it would be really good for NPP to have a keyboard shortcut to select the current line. Since Ctrl-Shft-L is already taken, I am thinking Ctrl-Shft-. (period) might be a good shortcut. And I also think it would be helpful to add the Select Line option to Edit -> Line Operations menu where the new shortcut could be easily visible.

    I understand that a person could use the multiple key sequence Home, Shft-End or Home, Shft-DnArrow, but that is a keyboard sequence, not a keyboard shortcut in my book. On lines with an indent, the sequence would be Home, Home, Shft-End. Also, based on behavior in multiple editors I have seen, it seems safer to select line-start to line-end rather than line-start to line-start, because I have seen more than one editor operate on the second line to some extent when I didn’t want it. Multiple Blank Operations affect the space at the beginning of the line and that is why one would want to press Home, Home on an indented line.

    Perhaps the shortcut could do double duty by having a multiple line select behavior when multiple lines are already selected. The behavior could be intended to avoid affecting a line after the selection and ensuring that the beginnings of lines are included in the selection. By that I mean the selection would move to the end of the previous line if the selection was at the beginning of the last line, and the selection would move to the end of the last line if the selection was in the middle of the last line.

    I created a GitHub feature request for select current line, but I have doubts this request will seem interesting to developers if there is no interest on the forum.

    I welcome any comments on why this new shortcut would be a waste of time, or comments on why it might be valuable to you.

    T P 2 Replies Last reply Jan 24, 2024, 9:42 PM Reply Quote 1
    • T
      Terry R @Stefan Ozminski
      last edited by Jan 24, 2024, 9:42 PM

      @Stefan-Ozminski
      I would suggest you read this post where some ideas were put forward.

      Terry

      S 1 Reply Last reply Jan 24, 2024, 11:19 PM Reply Quote 0
      • P
        PeterJones @Stefan Ozminski
        last edited by Jan 24, 2024, 10:40 PM

        @Stefan-Ozminski said,

        I created a GitHub feature request for select current line

        Since he didn’t have the upvotes to post a link, here it is:
        https://github.com/notepad-plus-plus/notepad-plus-plus/issues/14631

        but I have doubts this request will seem interesting to developers if there is no interest on the forum

        The decision-maker (Don) doesn’t read this forum, except for replies to his Announcement posts and similar. No amount of discussion or upvoting here will affect whether or not he thinks people are interested. OTOH, replies and upvotes at GitHub are visible to him, so that’s where it’s critical to have responses.

        S 1 Reply Last reply Jan 24, 2024, 11:09 PM Reply Quote 1
        • S
          Stefan Ozminski @PeterJones
          last edited by Jan 24, 2024, 11:09 PM

          @PeterJones,

          Thanks for the upvote information. However, that practice seems to strongly favor the votes of developers and those sufficiently interested in submitting issues that they will register on GitHub and then browse the existing issues. i.e. Exclusive rather than inclusive.

          P 1 Reply Last reply Jan 24, 2024, 11:31 PM Reply Quote 0
          • S
            Stefan Ozminski @Terry R
            last edited by Jan 24, 2024, 11:19 PM

            @Terry-R,

            The best sequence seems to be End, Alt-Shft-Home, because I imagine there are more cases where one would want the cursor to land at the beginning of the line rather than the end.

            I have seen lots of suggestions for creating a macro to do operations like that, but when one has NPP installed on multiple servers and workstations it is a lot more manageable to have the keyboard shortcut built into the app. Plus, an advanced use of the keyboard shortcut that works on multiple selected lines would be difficult to put in a macro (beyond what many users could to).

            Manually adding a macro that selects a line would not be a complement to triple click, since triple click is built-in.

            1 Reply Last reply Reply Quote 0
            • P
              PeterJones @Stefan Ozminski
              last edited by Jan 24, 2024, 11:31 PM

              Thanks for the upvote information.

              However, that practice seems to strongly favor the votes of developers and those sufficiently interested in submitting issues that they will register on GitHub and then browse the existing issues. i.e. Exclusive rather than inclusive.

              It’s not like I’m forcing Don’s to ignore the forum. I am letting you know what Don’s behavior actually is. If you want the upvotes or comments to be seen by Don in order to influence his decision, it has to be in GitHub.

              1 Reply Last reply Reply Quote 3
              • A
                Alan Kilborn
                last edited by Alan Kilborn Jan 25, 2024, 1:59 AM Jan 25, 2024, 1:52 AM

                Not that the OP wants this, but, in addition to the macro approach, it can be done with a PythonScript that is tied to a shortcut keycombo.

                # -*- coding: utf-8 -*-
                from __future__ import print_function
                
                # refs:
                #  https://community.notepad-plus-plus.org/topic/25408/keyboard-shortcut-to-select-current-line-to-complement-triple-click
                #  for newbie info on PythonScripts, see https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript
                
                from Npp import *
                
                def select_line(line_number=None):
                    if line_number is None: line_number = editor.lineFromPosition(editor.getCurrentPos())
                    p1 = editor.positionFromLine(line_number)
                    p2 = editor.positionAfter(editor.getLineEndPosition(line_number))
                    editor.setSel(p1, p2)
                
                select_line()
                
                1 Reply Last reply Reply Quote 1
                6 out of 7
                • First post
                  6/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors