Community
    • Login

    improve SCI_LINEDELETE shortcut

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    27 Posts 4 Posters 2.7k 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.
    • Alan KilbornA
      Alan Kilborn @Victorel Petrovich
      last edited by

      @Victorel-Petrovich said in improve SCI_LINEDELETE shortcut:

      That’s advanced

      :-)

      Victorel PetrovichV 1 Reply Last reply Reply Quote 0
      • Victorel PetrovichV
        Victorel Petrovich @Alan Kilborn
        last edited by Victorel Petrovich

        Who doesn’t like a bit of praise :)
        From my tests of your script, in following cases:

        1. put caret on start of a line, press shift+Down one or more times; the script doesn’t delete the line where the caret end
        2. Similarly for the line where anchor is at column0, when press shift+Up 1+ times.

        It appears you did so on purpose with these lines:

        if sel_start_pos != sel_end_pos and sel_end_pos == editor.positionFromLine(sel_line_end):
            # adjust for case where there is some selected text and caret is on a line by itself, i.e., no actual selected text on line of caret:
            sel_line_end -= 1
        

        Although, I agree it’s debatable whether that line should be deleted in case 2. above : in that case, it doesn’t look like the second line has been touched by selection at all. It looks almost same as when fully select first line from End to Start:
        87ef58e1-7e93-42a6-beac-06bdc8b8ea8a-Capture.PNG

        On the other hand, in case 1. above, it is clear that the line has been marked:
        30d5e542-87a9-4cf7-8ee7-69b6f7e1e2d1-Capture.PNG

        So, perhaps the ideal rule would be:
        Delete all lines either with selection within or where caret resides.

        But, for patch to Scintilla, I’ll probably have to delete the line in both cases, for consistency with SCI_LINECOPY and SCI_LINECUT.

        Alan KilbornA 2 Replies Last reply Reply Quote 0
        • Alan KilbornA
          Alan Kilborn @Victorel Petrovich
          last edited by

          @Victorel-Petrovich said in improve SCI_LINEDELETE shortcut:

          It appears you did so on purpose with these lines

          Indeed. If I can see a selection (in “inverse video”), then only likes where I can see that inverse video are the ones I’d want to be deleted.

          That’s my preference, but it is also the way a lot of Notepad++ line operations work.

          Victorel PetrovichV 1 Reply Last reply Reply Quote 0
          • Victorel PetrovichV
            Victorel Petrovich @Alan Kilborn
            last edited by Victorel Petrovich

            Well, but since caret by itself can be accepted as marker of line, then it also makes sense to accept it after one(or more)fully selected lines. (second pic above).

            Which “inverse video”?

            EDIT: it’s not about your script per see (anymore). Just exchanging opinions. Maybe one day I’ll suggest this to Scintilla about all of SCI_ COPY/CUT/DELETE.

            Alan KilbornA 1 Reply Last reply Reply Quote 0
            • Alan KilbornA
              Alan Kilborn @Victorel Petrovich
              last edited by

              @Victorel-Petrovich said in improve SCI_LINEDELETE shortcut:

              but since caret by itself can be accepted as marker of line, then it also makes sense to accept it after one(or more)fully selected lines

              For you maybe; not for me. And, as I said, not for a lot of of Notepad++ functions that work for lines in selection.

              One of the virtues of scripts; everyone can easily have what they want, by tweaking the code.

              The “caret by itself” situation is handled to delete its line. Just not “caret by itself on an otherwise non-selected line”.

              inverse video

              Just a quick way of saying what the text that is selected looks like.

              Victorel PetrovichV 1 Reply Last reply Reply Quote 0
              • Alan KilbornA
                Alan Kilborn @Victorel Petrovich
                last edited by Alan Kilborn

                @Victorel-Petrovich said in improve SCI_LINEDELETE shortcut:

                for patch to Scintilla, I’ll probably have to delete the line in both cases, for consistency with SCI_LINECOPY and SCI_LINECUT.

                Please tell me you aren’t prototyping a Scintilla patch using these scripts you’ve submitted in this thread. Such a patch should be much simpler than that.

                1 Reply Last reply Reply Quote 0
                • Victorel PetrovichV
                  Victorel Petrovich @Alan Kilborn
                  last edited by Victorel Petrovich

                  @Alan-Kilborn said in improve SCI_LINEDELETE shortcut:

                  The “caret by itself” situation is handled to delete its line. Just not “caret by itself on an otherwise non-selected line”.

                  I prefer less exceptions; but to each his own.
                  Indeed, scripting solves the differences.

                  @Alan-Kilborn said in improve SCI_LINEDELETE shortcut:

                  Please tell me you aren’t prototyping a Scintilla patch using these scripts you’ve submitted in this thread. Such a patch should be much simpler than that.

                  I know.

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