Community
    • Login

    "Join Lines" with trailing whitespace anomaly, older npp versions

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 4 Posters 78 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.
    • Neil SchipperN
      Neil Schipper
      last edited by

      Hello.

      A macro I considered reliable yielded some unexpected output which led me to investigate, and to my surprise the anomaly was traced to the Join Lines operation.

      To produce the unexpected result start with 3 consecutive lines where:

      • 1st line has 1 or more trailing spaces
      • 2nd line is empty (nothing but CR/LF)
      • 3rd line has some text.
      this line has a trailing space followed by an empty line 
      
      just a normal line
      

      Now make a selection that starts anywhere on line 1 and ends anywhere on line 3 beyond column 1. Issue “Join Lines” by menu or shortcut.

      Expected is all the text from the 3 lines is on a single line (ofc ending in CR/LF).

      Observed is 2 lines; the 1st contains original line 1 text but it ends in a single CR – the LF was dropped! ; the 2nd is identical to the original line 3.

      d16ad48b-2bcf-4f70-8265-7906b02bf999-image.png

      This behavior occurs in versions v8.1.9 (32-bit, portable) and v8.4.5 (32-bit, portable) but the expected, correct behavior occurs with v8.7.5 (64-bit, installed).

      In all cases, Windows (CR LF), UTF-8.

      I searched for discussion of this issue both here and on Github but failed to find any mention of it. I do consider it pretty unlikely that I’m the first to encounter this problem since it’s such a basic function operating under not terribly unusual conditions. And the misbehavior would likely have existed over a non-trivial time span. So I’m curious if anyone has familiarity with it, and anyway, in the off chance this is a new discovery, at least someone who has a strong need to stay with an old version might find this post in a search and be better positioned to decide how to proceed.

      1 Reply Last reply Reply Quote 2
      • guy038G
        guy038
        last edited by guy038

        Hello, @neil-schipper, and All,

        I can confirm that the Edit >Line Operations > Join Lines ( Ctrl + J ) works correctly in portable x64 N++ versions 8.6.2 / 8.7.6 and the last 8.8.3 release.

        I tried to see what has changed between the 8.4.6 and the v8.6.1 releases, in order to get the correct behavior, from the link below, though without any pertinent result :

        https://github.com/notepad-plus-plus/notepad-plus-plus/wiki/Changes#8x

        Best Regards,

        guy038

        Neil SchipperN 1 Reply Last reply Reply Quote 1
        • Neil SchipperN
          Neil Schipper @guy038
          last edited by

          Hi @guy038,

          Thanks. That “Changes” page you linked spans 4 years of development and the word “join” doesn’t appear once!

          I wouldn’t be surprised if the code underwent “self-healing” when a developer decided to use a more advanced (= lots of built-in safety, lots of tests) buffer object / library which allowed a bunch of hand-crafted string handling code (maybe duplicated in a bunch of places) to be factored out.

          And I smile when I write this because of a comedic article I once read where the guy explains that when a warning light he’s never seen before comes on on his car’s dashboard, his natural response is to… ignore it for a bunch of months to see if the process of “automotive self-healing” kicks in!

          1 Reply Last reply Reply Quote 1
          • CoisesC
            Coises
            last edited by

            @Neil-Schipper, @guy038:

            It was a Scintilla bug; see:

            https://sourceforge.net/p/scintilla/bugs/2372/

            https://github.com/notepad-plus-plus/notepad-plus-plus/commit/43182e1d048e136a0e7bd1756a35da865876b92f

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

              @Coises said in "Join Lines" with trailing whitespace anomaly, older npp versions:

              @Neil-Schipper, @guy038:

              It was a Scintilla bug; see:

              https://sourceforge.net/p/scintilla/bugs/2372/

              … which was fixed in scintilla 5.3.3 (per https://scintilla.org/ScintillaHistory.html at 5.3.3)

              And so that updating to 5.3.3 was mentioned in Changes for v8.5 item 3.

              Unfortunately, it is not feasible for N++ changelist to list every change for a given scintilla upgrade, so it makes it harder to find such things.

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