Community
    • Login

    Is There a Way to Prevent Pasted Text from Spreading Out with Rows of Spaces?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    13 Posts 2 Posters 778 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.
    • PeterJonesP
      PeterJones @Troglo37
      last edited by

      @Troglo37 said in Is There a Way to Prevent Pasted Text from Spreading Out with Rows of Spaces?:

      Something akin to Paste Special > Unformatted Text, More Options in LibreOffice Writer that could be done with a one-click feature.

      Have you tried that feature in LibreOffice Writer, with the exact text that you did in Notepad++? Because, as I explained, the newlines are in the plain text version of the clipboard. When you do that exact Paste Special > Unformatted Text, LibreOffice Writer does exactly what Notepad++ does:
      ad020026-9d9e-4680-bced-c7326056fdb2-image.png
      … or, in words: it pastes the text in, with the newlines, because that is unformatted text. Newlines aren’t “magic formatting” like HTML <LI> or <H3> are – they are an integral part of the unformatted plain text.

      “Paste Without Newlines” might be a reasonable feature to a tiny number of people (you, and a relative handful of others)… but Notepad++ doesn’t include it natively, because that’s not a feature that would have broad appeal. (And Notepad++'s normal paste is already the “paste unformatted text”, because that’s literally what pasting the CF_TEXT entry from the clipboard does; you have to use the Edit > Paste Special > Paste HTML/RTF Content actions to get it paste the “formatted” text, though it actually pastes the source code of the formatted text, ie, the raw HTML or RTF rich text, because Notepad++ is not a word processor, which is what LibreOffice Writer is.)

      In theory, a plugin could be made specficially for “Paste Without Newlines”… but with just the one feature, that would be a waste of effort. Instead, it would be best as a script in PythonScript or LuaScript. I will probably even spend some time on implementing it in PythonScript today, depending on how much life interrupts.

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

        @PeterJones said in Is There a Way to Prevent Pasted Text from Spreading Out with Rows of Spaces?:

        implementing it in PythonScript today

        Thankfully, I found an old script which did something related, which was easy to update.

        # encoding=utf-8
        """in response to https://community.notepad-plus-plus.org/topic/27385/
        
        This will paste the CF_TEXT plaintext from the clipboard, but will convert any series of newline characters into a single space before doing the paste.
        
        Because this uses .insertText() instead of putting the modified text back into the clipboard and doing .paste(), it should avoid clobbering the clipboard.
        
        (based on @alan-kilborn's clipboard script here:
        <https://community.notepad-plus-plus.org/post/97132>)
        """
        from Npp import *
        
        try:
            editor3h  # third editor, hidden
        except NameError:
            editor3h = notepad.createScintilla()
        
        def get_clipboard_text_without_newlines():
            retval = ''
            editor3h.clearAll()
            editor3h.paste()
            if editor3h.getLength() > 0:
                editor3h.rereplace(r'[\r\n]+', ' ') # replace all newline seqeuences with a single space
                retval = editor3h.getText()
            return retval
        
        editor.beginUndoAction()
        editor.insertText(editor.getCurrentPos(), get_clipboard_text_without_newlines())
        editor.endUndoAction()
        

        This has been tested in the PythonScript 3 plugin. The PythonScript FAQ explains how to install PythonScript plugin, and how to run a script using PythonScript plugin, and even how to assign a keyboard shortcut to the script. Make sure you follow the instructions for PythonScript 3, not PythonScript 2 (as I have not tested under the older plugin syntax, though it will likely work there)

        Troglo37T 1 Reply Last reply Reply Quote 1
        • PeterJonesP PeterJones referenced this topic on
        • Troglo37T
          Troglo37 @PeterJones
          last edited by

          @PeterJones Sorry it took so long. I was dealing with a lot of issues. Washing machine, car, and several other things.

          I tried installing Python v3.0.24 msi, and zip Full, but I don’t see it anywhere in the Plugins section. Initially, I installed 2.1. I uninstalled it and tried installing v3.0.24, but 2.1 is still there.

          What am I doing wrong?

          P.S. I didn’t try any of the v3.0.24 x64, PluginAdmin, Min, or TclTk.

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

            I tried installing Python v3.0.24 msi, and zip Full, but I don’t see it anywhere in the Plugins section. Initially, I installed 2.1. I uninstalled it and tried installing v3.0.24, but 2.1 is still there.

            What am I doing wrong?

            Since you just gave a high-level description, rather than any actual data, it’s really hard to tell.

            I uninstalled it and tried installing v3.0.24, but 2.1 is still there.

            Then you didn’t uninstall it. Please note that under many conditions, the Plugins Admin uninstall button doesn’t work if Notepad++ has accessed the PythonScript plugin at all that run, because it’s loaded the DLL into memory, and thus cannot delete the file – so if you have any AT START, that virtually guarantees that uninstall button won’t work. (I believe there was an Issue or PR to try to make uinstall button more reliable, but I don’t remember whether that was implemented, or whether it was even feasible.) So, anyway, your best bet is to exit Notepad++ completely, and delete C:\Program Files\Notepad++\plugins\PythonScript\.

            P.S. I didn’t try any of the v3.0.24 x64, PluginAdmin, Min, or TclTk.

            You didn’t try the 64-bit version of PythonScript? The last time you shared Debug Info (and the time before that) you were using 64-bit Notepad++. So why would you try anything but 64-bit PythonScript. It is 100% guaranteed that it will not work if you try to use the 32-bit PythonScript with a 64-bit Notepad++.

            If you ran the 32-bit MSI on a 64-bit OS, it would have tried to install the plugin into C:\Program Files (x86)\Notepad++\Plugins\PythonScript , which, of course, couldn’t be seen if you are running the 64-bit Notepad++ executable at C:\Program Files\Notepad++\notepad++.exe .

            If you tried one of the zips, you didn’t say where you put it, or what the directory hierarchy would have been. But if you were still seeing PythonScript 2.1 in Notepad++, it means you didn’t put it in the right place. And I have no clue where you would have put it.

            So the things you will need to do:

            1. Run Notepad++ as normal, and verify with Debug Info that you are using 64-bit, and that it is running from c:\Program Files\Notepad++ .
              • If you don’t get it working after these instructions, you must share your Debug Info, otherwise it will be impossible to give you better instructions.
              • The rest of these instructions will assume normal installation directory, normal 64-bit Notepad++
            2. Exit Notepad+++ completely. No instances running.
            3. Go to C:\Program Files\Notepad++\plugins\PythonScript\ . If there’s anything in there, remove it (and the directory)
            4. Grab PythonScript_Full_3.0.24.0_x64_PluginAdmin.zip (I don’t use the MSI, so cannot give reliable instructions for that MSI installation method). Unzip it so that the following exist:
              • C:\Program Files\Notepad++\plugins\PythonScript\PythonScript.dll
              • C:\Program Files\Notepad++\plugins\PythonScript\python312.dll
              • C:\Program Files\Notepad++\plugins\PythonScript\doc\
              • C:\Program Files\Notepad++\plugins\PythonScript\lib\
              • C:\Program Files\Notepad++\plugins\PythonScript\scripts\
                If those aren’t all there, you didn’t unzip things correctly.
            5. Start Notepad++. It should show PythonScript in the Plugins menu, and Plugins > Python Script > About should show plugin version 3.0.24.0 with Python 3.12.0
              3ba2f6f7-5bfc-4a38-9546-9bfbe945a8eb-image.png

            If it’s not working for you after following those instructions, you must share

            • ?-menu’s Debug Info
            • dir "c:\Program Files\Notepad++"
            • dir "c:\Program Files\Notepad++\Plugins"
            • dir "c:\Program Files\Notepad++\Plugins\PythonScript"
            Troglo37T 1 Reply Last reply Reply Quote 2
            • Troglo37T
              Troglo37 @PeterJones
              last edited by

              @PeterJones I’m having trouble correctly unzipping PythonScript_Full_3.0.24.0_x64_PluginAdmin.zip

              I tried putting the zip file into the plugins folder via Plugins > Open Plugins Folder, but Windows won’t allow unzipping in that location.

              I tried unzipping in my Compressed folder, then put all of the unzipped items into the Plugins Folder. That didn’t work either.

              I checked, and I only see Python Script 2.1 in Plugins Admin. Strange, because I deleted those items.

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

                @Troglo37 ,

                You may need UAC / Admin permission to write to the Plugins directory.

                If PythonScript 2.1 is still there, you didn’t delete the right directory.

                I told you what information we would need to help you further, and you chose to not share it

                Good luck.

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

                  @PeterJones Oops, I was so wrapped up in trying to make it work, I forgot!

                  I don’t see anything with Plugins in the Debug info.

                  Notepad++ v8.9.2 (64-bit)
                  Build time: Feb 13 2026 - 02:47:53
                  Scintilla/Lexilla included: 5.5.8/5.4.6
                  Boost Regex included: 1_90
                  pugixml included: 1.15
                  nlohmann JSON included: 3.12.0
                  Path: C:\Program Files\Notepad++\notepad++.exe
                  Command Line: “D:\D Drive Documents\Znew 2.tex”
                  Admin mode: OFF
                  Local Conf mode: OFF
                  Cloud Config: OFF
                  Periodic Backup: ON
                  Placeholders: OFF
                  Scintilla Rendering Mode: SC_TECHNOLOGY_DEFAULT (0)
                  Multi-instance Mode: monoInst
                  asNotepad: OFF
                  File Status Auto-Detection: cdEnabledNew (for current file/tab only)
                  Dark Mode: OFF
                  Display Info:
                  primary monitor: 3840x2160, scaling 175%
                  visible monitors count: 1
                  installed Display Class adapters:
                  0000: Description - NVIDIA GeForce RTX 2080 SUPER
                  0000: DriverVersion - 32.0.15.8157
                  OS Name: Windows 10 Home (64-bit)
                  OS Version: 22H2
                  OS Build: 19045.6466
                  Current ANSI codepage: 1252
                  Plugins:
                  mimeTools (3.1)
                  NppConverter (4.7)
                  NppExport (0.4)
                  _CustomizeToolbar (5.3)

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

                    @Troglo37 said in Is There a Way to Prevent Pasted Text from Spreading Out with Rows of Spaces?:

                    @PeterJones Oops, I was so wrapped up in trying to make it work, I forgot!

                    I don’t see anything with Plugins in the Debug info.

                    What I see in the Debug Info is:

                    1. It really is 64-bit Notepad++ in the normal installation directory, with normal AppData config and not running in Admin mode
                    2. You do not have PythonScript 2.1 at this point

                    What I don’t see in your answer are any of the directory listings that my post requested. :-(

                    At this point, the steps I would take, if I were you and trying to get this working:

                    1. Exit Notepad++
                    2. Do the directory listing(s) that I suggested above, to see whether there’s a PythonScript directory and what’s in it
                    3. Do the unzip described above, making sure to say yes to the UAC to allow you to put files in the protected directory (it may be that Windows is showing the UAC prompt, but it might not put it to the foreground – if you don’t see the prompt, check your taskbar for the UAC icon and click on it if it’s there)
                    4. Do the directory listing(s) again, to make sure it correctly populated. If it didn’t, try again.
                    5. Run Notepad++, and check for PythonScript. If it’s there, look at the About.

                    If it’s still not installed 3.0.24, you will need to show us the directory listings from 2 and 4, and any dialogs or error messages you see at any point in the instructions.

                    Troglo37T 1 Reply Last reply Reply Quote 1
                    • Troglo37T
                      Troglo37 @PeterJones
                      last edited by

                      @PeterJones I’m confused about a couple of things.

                      1. I’m not sure what you mean by supplying the following debug info. How do I do that? The only thing I know how to do is what I provided to you.

                      ?-menu’s Debug Info
                      dir “c:\Program Files\Notepad++”
                      dir “c:\Program Files\Notepad++\Plugins”
                      dir “c:\Program Files\Notepad++\Plugins\PythonScript”

                      1. Please give exact instructions on how and where to extract the file. Should I extract the file to a folder, and then move the extracted contents to a particular location? Or should I put it in a particular location before extracting it?

                      P.S. I manually opened c:\Program Files\Notepad++. There are no Python files or folders in the Plugin folder.

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

                        @Troglo37 said in Is There a Way to Prevent Pasted Text from Spreading Out with Rows of Spaces?:

                        @PeterJones I’m confused about a couple of things.

                        I’m not sure what you mean by supplying the following debug info. How do I do that? The only thing I know how to do is what I provided to you.

                        ?-menu’s Debug Info

                        Right. That was the Debug Info that was in your last post.

                        dir “c:\Program Files\Notepad++”
                        dir “c:\Program Files\Notepad++\Plugins”
                        dir “c:\Program Files\Notepad++\Plugins\PythonScript”

                        Since that same syntax has been used for directory listings in the Microsoft OS command -line environment since the 80s (in DOS back then, and in cmd.exe in modern Windows), I assumed my meaning was obvious. Since it wasn’t, I will explain: Those are me asking for directory listings for each of those directories.

                        Please give exact instructions on how and where to extract the file.

                        Do you not know how to unzip a .zip in Windows? You right click, and choose to extract all. Easiest is to put it in a temporary directory to start. Then copy all the contents of that directory, and put it into C:\Program Files\Notepad++\Plugins\PythonScript (which is the destination directory that I already told you about, above)

                        After you have done that, the directory should contain the files and subdirectories I mentioned above.

                        If it doesn’t, give me something to work with: Screenshots, text dumps of directory listings, whatever you can do to give me real information, rather than vague responses.

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