Community
    • Login

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

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 52 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.
    • Troglo37T
      Troglo37
      last edited by

      This has been bugging me for a long time. Is there a way to prevent Notepad++ from displaying rows of blank space when pasting text from IMDB? I tried all of the settings in the Find box, but nothing happened.

      For example, https://www.imdb.com/name/nm0000078/ then click on ‘1 episode’ for Gunsmoke, highlight, and copy Gunsmoke

      1 episode
      1955
      

      See what happens even here?

      To remove the spaces easily, I have to either use DuckDuckGo’s search box or the Everything search program to get the result Gunsmoke 1 episode 1955.

      Using those prevents the text from spreading out with rows of blank space. All I have to do is click in front of 1955, use the back button 4 times, click in front of 1 episode, then use the back button 5 times.

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

        This has been bugging me for a long time. Is there a way to prevent Notepad++ from displaying rows of blank space when pasting text from IMDB? I tried all of the settings in the Find box, but nothing happened.

        For example, https://www.imdb.com/name/nm0000078/ then click on ‘1 episode’ for Gunsmoke, highlight, and copy Gunsmoke

        1 episode
        1955
        

        See what happens even here?

        Yes. When you copy that text from the webbrowser, the browser puts the string Gunsmoke\n1 episode\n1955 (with newline characters) into the CF_TEXT, CF_OEMTEXT, and CF_UNICODE slots of the Windows clipboard. Then when you paste in Notepad++ (or notepad.exe, or any other text editor which is requesting one of those text slots from the Windows clipboard), Notepad++ correctly pastes what’s there, honoring the newline settings to interpret the newline in the data that you are pasting, just like Notepad++ always does. (And, BTW, pasting that text into Windows notepad.exe also correctly puts the newline between the lines, because that is IN THE CLIPBOARD TEXT)

        Using those prevents the text from spreading out with rows of blank space. All I have to do is click in front of 1955, use the back button 4 times, click in front of 1 episode, then use the back button 5 times.

        Notepad++ cannot know that you visually saw a single line in the rendered HTML browser, because all Notepad++ is told is that when it requests the CF_TEXT or similar, there’s a newline there, so it needs to handle that newline the same way it does every other newline in pasted data. To do anything else would break user expectation, and would be considered a crippling bug in the software.

        And what you don’t understand is that, even to your browser, that’s not a single line of text. The word Gunsmoke is in an H3 tag, 1 episode is inside an <li> tag, and 1955 is in a separate <li> tag. They are three independent pieces of data, which the stylesheet just happens to present as having the two LI elements on the same “line” when rendered. But when your browser puts that data in the clipboard, it separates them with newline symbols. It’s not Notepad++'s fault, and Noteopad++ cannot read your mind in what you “want” from the data: it assumes that since you’re pasting text, that you want to paste the exact text that’s in the CF_TEXT or equivalent slot in the clipboard, so that’s what it does.

        To save keystrokes to fix it, you can hold down the shift key, hit HOME then UP then UP, the Ctrl+J to join the lines.

        But the “problem” is not on Notepad++'s end. Notepad++ correctly pastes the data that is in the text portion of the Windows clipboard.

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