Community
    • Login

    Automatically copy selected text?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 4 Posters 6.1k 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.
    • Georg TrimbornG
      Georg Trimborn
      last edited by

      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!

      PeterJonesP Michael VincentM 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Georg Trimborn
        last edited by

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

        Alan KilbornA 1 Reply Last reply Reply Quote 0
        • Michael VincentM
          Michael Vincent @Georg Trimborn
          last edited by

          @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
          • Alan KilbornA
            Alan Kilborn @PeterJones
            last edited by

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

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

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

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

                @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. :)

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

                  @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. :-)

                  Alan KilbornA 1 Reply Last reply Reply Quote 1
                  • Alan KilbornA
                    Alan Kilborn @PeterJones
                    last edited by

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

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

                      @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
                      • PeterJonesP PeterJones referenced this topic on
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors