• Login
Community
  • Login

Automatically copy selected text?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
9 Posts 4 Posters 6.3k 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.
  • G
    Georg Trimborn
    last edited by Jul 29, 2020, 7:26 PM

    Some platforms (Unix/X11) and tools (UltraEdit) can automatically copy selected text to the clipboard (without having to ctrl-C or right-click). Is there some way to configure Notepad++ to do this?

    Thanks!

    P M 2 Replies Last reply Jul 29, 2020, 7:33 PM Reply Quote 0
    • P
      PeterJones @Georg Trimborn
      last edited by Jul 29, 2020, 7:33 PM

      @Georg-Trimborn ,

      That is not a feature that’s been implemented in Notepad++, as far as I know. If someone else disagrees, they can chime in.

      Given the right notification to hook into, it might be doable in PythonScript or thru a plugin, but I don’t know of an already-existing plugin that handles that, nor do I know off the top of my head which is the right Scintilla notification to hook into.

      A 1 Reply Last reply Jul 31, 2020, 7:01 PM Reply Quote 0
      • M
        Michael Vincent @Georg Trimborn
        last edited by Jul 29, 2020, 7:57 PM

        @Georg-Trimborn said in Automatically copy selected text?:

        Is there some way to configure Notepad++ to do this?

        This plugin supposedly does that:

        https://github.com/KubaDee/SelectToClipboard/

        Cheers.

        1 Reply Last reply Reply Quote 2
        • A
          Alan Kilborn @PeterJones
          last edited by Jul 31, 2020, 7:01 PM

          @PeterJones said in Automatically copy selected text?:

          …Pythonscript…which is the right Scintilla notification to hook into.

          Wouldn’t one just hook into the editor window’s WM_LBUTTONUP message, and then if editor.getSelectionEmpty() is False, do an editor.copy() ?

          If I had such a feature, I’d like something like an Esc keypress in between WM_LBUTTONDOWN and WM_LBUTTONUP to cancel the automatic copy, for those “oops” moments.

          P 1 Reply Last reply Jul 31, 2020, 7:55 PM Reply Quote 0
          • P
            PeterJones @Alan Kilborn
            last edited by PeterJones Jul 31, 2020, 7:56 PM Jul 31, 2020, 7:55 PM

            @Alan-Kilborn said in Automatically copy selected text?:

            Wouldn’t one just hook into the editor window’s WM_LBUTTONUP message, and then if editor.getSelectionEmpty() is False, do an editor.copy() ?

            That would probably do what was described/requested, yes.

            for those “oops” moments.

            “I had a huge amount of text in the clipboard, then I selected one word in Notepad++ because I was going to paste the clipboard to replace that word, and now my clipboard just contains that one word!”

            I think in the X11 (linux gui) environment, there are actually two copy-buffers: one for manual Ctrl+C/Ctrl+V and one for the selection-buffer, otherwise the sequence below wouldn’t work

            -----

            manual copy : __
            
            selection
            
            final paste: 
            
            ------
            
            1. copy "manual copy" using Ctrl+C
            2. highlight "selection"
            3. paste using Ctrl+V 
                => pastes "manual copy", not "selection", 
                so highlight-selection obviously didn't 
            4. undo
            5. select "selection"
            6. middle click between the underscores
                => it pastes "selection"
            7. go to after "final paste:" and Ctrl+V paste
                => it pastes "manual copy", so the 
                pasting of the highlighted "selection"
                didn't overwrite the clipboard
            

            -----

            Personally, if I had such a feature in Notepad++, I would want it to be “look at the contents of the active selection, and insert that text here”, not “put the contents of the active selection in the clipboard then paste here”. Of course, that would only work inside of Notepad++, and wouldn’t have the cross-application capabilities that X11 includes for the selection-buffer pasting.

            A 1 Reply Last reply Jul 31, 2020, 8:26 PM Reply Quote 2
            • A
              Alan Kilborn @PeterJones
              last edited by Jul 31, 2020, 8:26 PM

              @PeterJones

              Two buffers is a good idea, although as you state it requires two different ways of invoking a paste. The one for the auto-copied text might be thought of as a Paste-special.

              Personally, if I had such a feature in Notepad++, I would want it to be “look at the contents of the active selection, and insert that text here”, not “put the contents of the active selection in the clipboard then paste here”

              For some reason that made my head hurt, but I think I understand its meaning. :)

              P 1 Reply Last reply Jul 31, 2020, 8:52 PM Reply Quote 0
              • P
                PeterJones @Alan Kilborn
                last edited by Jul 31, 2020, 8:52 PM

                @Alan-Kilborn said in Automatically copy selected text?:

                Two buffers is a good idea, although as you state it requires two different ways of invoking a paste. The one for the auto-copied text might be thought of as a Paste-special.

                Not to be confused with this Paste-special. :-)

                Oddly, my Chrome browser in Windows (and/or this forum) actually already has a second buffer or equivalent: when I highlight the above line and click Reply, it auto-populates with just that portion of your text. But my clipboard is still there, because I was able to paste the URL. :-)

                A 1 Reply Last reply Jul 31, 2020, 9:00 PM Reply Quote 1
                • A
                  Alan Kilborn @PeterJones
                  last edited by Jul 31, 2020, 9:00 PM

                  @PeterJones said in Automatically copy selected text?:

                  Not to be confused with this Paste-special.

                  As I was composing earlier I almost said YAPS (yet-another-paste-special). Indeed, I already have a subfolder under Scripts in my Pythonscript menu in N++ called PasteSpecial (because there are a lot of them). What I really need is a PasteSpecialManager.

                  my Chrome browser in Windows (and/or this forum) actually already has a second buffer or equivalent: when I highlight the above line and click Reply, it auto-populates with just that portion of your text

                  Yes, very handy, but there’s no reason that functionality even needs to mess with the clipboard to do what it does. Like when a Pythonscript does editor.getSelText() in order to manipulate some text (within N++), the clipboard is not involved/affected.

                  P 1 Reply Last reply Jul 31, 2020, 9:01 PM Reply Quote 1
                  • P
                    PeterJones @Alan Kilborn
                    last edited by Jul 31, 2020, 9:01 PM

                    @Alan-Kilborn said in Automatically copy selected text?:

                    there’s no reason that functionality even needs to mess with the clipboard to do what it does

                    Indeed. That was the point I was trying to make that made your head hurt. :-)

                    1 Reply Last reply Reply Quote 1
                    • P PeterJones referenced this topic on Jul 22, 2024, 12:35 PM
                    4 out of 9
                    • First post
                      4/9
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors