Community
    • Login

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

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    19 Posts 3 Posters 1.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.
    • 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.

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

                @PeterJones I got it to work. I copied the files as instructed. However, there are a few things I need to know.

                1. Should I delete python27.dll from the PythonScript folder? This time, I copied and pasted and followed the prompt to replace the existing files. Last time, I deleted everything before copying over the extracted files. Is that why it didn’t work?

                2. How is the script enabled? The only way I can figure out how to make the script work is via the toolbar, Plugins > PythonScript > Run Previous Script (No New Lines)

                3. Is this the only way to enable it? Is there a way to make it automatic? Or at least, an icon on the toolbar? I tried doing that via Plugins > PythonScript > Configuration, but to no avail.

                4. Is it possible for the script to work without first pasting the IMDB text into the Find search box?

                PeterJonesP mpheathM 2 Replies Last reply Reply Quote 0
                • PeterJonesP
                  PeterJones @Troglo37
                  last edited by

                  1. Should I delete python27.dll from the PythonScript folder? This time, I copied and pasted and followed the prompt to replace the existing files. Last time, I deleted everything before copying over the extracted files. Is that why it didn’t work?

                  How could it be there? You literally said last time that the directory didn’t exist. If the directory didn’t exist, python27.dll cannot be in it already. If it did exist, you should have said it did exist.

                  1. How is the script enabled? The only way I can figure out how to make the script work is via the toolbar, Plugins > PythonScript > Run Previous Script (No New Lines)

                  Plugins > PythonScript > Scripts> No New Lines is the normal way to run the script.

                  The script doesn’t magically replace the old paste behavior: you run the script instead of doing a normal paste.

                  1. Is this the only way to enable it? Is there a way to make it automatic? Or at least, an icon on the toolbar? I tried doing that via Plugins > PythonScript > Configuration, but to no avail.

                  The FAQ explains how to add a shortcut and, IIRC, how to add a toolbar button.

                  1. Is it possible for the script to work without first pasting the IMDB text into the Find search box?

                  The script has absolutely nothing to do with the Find box. I have no clue how you got the impression that it requires that.

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

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

                    Is there a way to make it automatic?

                    If register a callback to respond to the notification SC_MOD_INSERTCHECK then it can be automated to change the text before insertion. This example code can be added to the user startup.py file. Make sure the PythonScript configuration is set to ATSTARTUP.

                    import re
                    
                    def event_paste_single_line(args):
                        SC_MOD_INSERTCHECK = 0x100000
                    
                        if args['modificationType'] & SC_MOD_INSERTCHECK:
                            text = args['text']
                    
                            if ' episode\r\n ' in text:
                                result = notepad.messageBox('Paste text as single line?',
                                                            'InsertCheck',
                                                            MESSAGEBOXFLAGS.ICONQUESTION |
                                                            MESSAGEBOXFLAGS.YESNO)
                    
                                if result == MESSAGEBOXFLAGS.RESULTNO:
                                    return
                    
                                text = re.sub(r'\s+', ' ', text)
                                editor.changeInsertion(text)
                    
                    editor.callbackSync(event_paste_single_line, [SCINTILLANOTIFICATION.MODIFIED])
                    

                    I added a messagebox to allow a choice rather then being fully automatic with the text change.

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

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

                      1. Should I delete python27.dll from the PythonScript folder? This time, I copied and pasted and followed the prompt to replace the existing files. Last time, I deleted everything before copying over the extracted files. Is that why it didn’t work?

                      How could it be there? You literally said last time that the directory didn’t exist. If the directory didn’t exist, python27.dll cannot be in it already. If it did exist, you should have said it did exist.

                      It didn’t exist at that time. I reinstalled 2.1 via Plugins Admin to restore the Python folder and pasted the extracted contents into it. Oh, and should I delete python27.dll?

                      1. Is it possible for the script to work without first pasting the IMDB text into the Find search box?

                      The script has absolutely nothing to do with the Find box. I have no clue how you got the impression that it requires that.

                      I had the idea before my OP, when I posted about using the Find box, DuckDuckGo, and Everything.

                      I don’t see anywhere in the FAQ how to apply an icon to the script.

                      Also, what icon would I use? Is there a way to create, or import one if none are available? BTW, I have the Old Large Legacy Icons installed, and there aren’t any unused ones available under Plugins > Customize Toolbar

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

                        It didn’t exist at that time. I reinstalled 2.1 via Plugins Admin to restore the Python folder and pasted the extracted contents into it. Oh, and should I delete python27.dll?

                        I would ask WHY?!… But honestly, at this point, it doesn’t matter. It won’t be used, but you could delete the 2.7 dll since it’s completely wasted space

                        I don’t see anywhere in the FAQ how to apply an icon to the script.

                        At some point, you are going to have to take the initiative and look at the PythonScript plugin documentation. It explains how to add a script to the toolbar.

                        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?:

                          I don’t see anywhere in the FAQ how to apply an icon to the script.

                          Reading the manual yourself would be more beneficial. But, to help you:

                          • Plugins > Python Script > Configuration…
                          • Choose either Machine Scripts (if your script is in c:\program files\notepad++\plugins\PythonScript\scripts hierarchy) or User Scripts (if your script is in %AppData%\Notepad++\plugins\Config\PythonScript\scripts hierarchy, where it should be for normal usage)
                          • Click on your script
                          • The Add button above the Toolbar icons panel at the right should be available now; click Add, and the script will be added
                          • Click the script in that panel, and click Set Icon…, and navigate to whatever 32x32 BMP or ICO you want to use
                          • If you exit Notepad++ and run it again, that script will have an button on the toolbar, using whatever icon you chose (or the Python icon if you didn’t choose one)

                          Or, since you said,

                          there aren’t any unused ones available under Plugins > Customize Toolbar

                          If you prefer using the Customize Toolbar, you can. However, there’s probably confusion that you need cleared up. Customize Toolbar has two separate ways of customizing the toolbar

                          1. It can manipulate the icon for tools that are already on the toolbar, or a few other builtin commands, using Plugins > Customize Toolbar > Customize Toolbar… interface, which you are likely familiar with
                            • I assume this is the one where you say, “there aren’t any unused ones available”. I cannot imagine that you’ve actually enabled another couple-dozen buttons from its list, so that there are no other “available toolbar buttons”, as that toolbar would be so full as to be unusable. On the other hand, that’s the only thing I imagine that you could mean by such a sentence.
                          2. It can add an icon for other builtin or plugin tools using its Custom Buttons
                            • Use Plugins > Customize Toolbar > Custom Buttons to add a checkmark to that option. It will tell you that it will take effect the next time you start Notepad++.
                            • You can use Plugins > Customize Toolbar > Help - Custom Buttons to read more about the syntax of the file, though the file itself will have comments that help you set things up
                            • exit Notepad++
                            • open Notepad++
                            • File > Open %AppData%\Notepad++\plugins\config\CustomizeToolbar.btn, which was created automatically when you checkmarked the option in the earlier step
                            • Use something akin to the following
                              Plugins,Python Script,Scripts,No New Lines,*R:PN,*R:PN,*R:PN
                              
                              • That setup assumes you named your script No New Lines, and that you want it to show up as a pseudo-icon with red background, with the text “PN” for “Paste: No New Lines”: d2e3ec03-e741-4d7f-a0f5-e92ca710deb1-image.png
                              • If you actually want icons, put NoNewLines.bmp, NoNewLines_light.ico, and NoNewLines_dark.ico in the same directory as CustomizeToolbar.btn

                          Important Things To Note

                          1. To add to toolbar, pick one of the two methods – either use the PythonScript Configuration… dialog, or use the Customize Toolbar’s Custom Buttons feature. DON’T USE BOTH AT THE SAME TIME
                          2. If you use the script I suggested, using a button makes sense. If you use the script @mpheath suggested, it just needs to be run ATSTARTUP, and you won’t need a button at all, because it will intercept the normal paste command.
                          1 Reply Last reply Reply Quote 1
                          • First post
                            Last post
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors