• Login
Community
  • Login

Replace line end symbols?

Scheduled Pinned Locked Moved General Discussion
9 Posts 7 Posters 2.8k 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.
  • V
    vanowm
    last edited by Oct 2, 2021, 2:35 AM

    Is there a way replace line end symbols?
    Currently CR/LF symbols are very large and distracting:
    4e5e256d-29bd-481a-ac9f-022307ef900d-image.png
    I’d like make look like in UEStudio:
    7fbd5e7a-9247-414e-b851-59fb9f7a411e-image.png

    Thank you.

    1 Reply Last reply Reply Quote 0
    • G
      gstavi
      last edited by Oct 2, 2021, 4:06 PM

      Not a reasonable way (NPP is open source so you could probably develop a way if you are a programmer).
      I am quite sure that these symbols come from Scintilla so you should check out there.
      Or just use UEStudio.

      A 1 Reply Last reply Oct 2, 2021, 7:24 PM Reply Quote 0
      • A
        astewart77 @gstavi
        last edited by Oct 2, 2021, 7:24 PM

        @gstavi said in Replace line end symbols?:

        these symbols come from Scintilla so you should check out there.

        They are Scintilla representations and there are Scintilla commands to change them, but I have not been able to find a simple way to make changes persist across files and tabs.

        Scintilla is embedded in Notepad++ and the default representations are easy to find in the .exe with a hex editor. They are two and three character representations, which makes them distracting. I editted a few that I use a lot - “NUL” "LF “CR” and “ESC” to “0” “n” "r and “e” - and that makes them permanent.
        HxD.png
        Highlight above is from LF to CR / “n” to “r” They are still shown with a reverse background, but only one character wide.

        Of course, you’d have to do the edit again for each Notepad++ update.

        A M 2 Replies Last reply Oct 4, 2021, 1:13 PM Reply Quote 1
        • A
          Alan Kilborn @astewart77
          last edited by Oct 4, 2021, 1:13 PM

          @astewart77 said in Replace line end symbols?:

          easy to find in the .exe with a hex editor. They are two and three character representations, which makes them distracting. I editted a few

          Now THAT is an ambitious approach to solving the problem! :-)

          1 Reply Last reply Reply Quote 0
          • M
            Michael Vincent @astewart77
            last edited by Oct 4, 2021, 2:43 PM

            @astewart77 said in Replace line end symbols?:

            They are Scintilla representations and there are Scintilla commands to change them, but I have not been able to find a simple way to make changes persist across files and tabs.

            Seems like there should be a way to use SCI_SETREPRESENTATION with NppExec or PythonScript to do this?

            Cheers.

            A 1 Reply Last reply Oct 4, 2021, 2:46 PM Reply Quote 1
            • A
              Alan Kilborn @Michael Vincent
              last edited by Oct 4, 2021, 2:46 PM

              @Michael-Vincent said in Replace line end symbols?:

              Seems like there should be a way to use SCI_SETREPRESENTATION with NppExec or PythonScript to do this?

              Yes, it can be done, with the complication that it has to be done on every tab switch, because N++ “resets” this aspect of Scintilla when the active document changes. IMO it is better than hacking the exe.

              P 1 Reply Last reply Oct 4, 2021, 2:56 PM Reply Quote 1
              • P
                PeterJones @Alan Kilborn
                last edited by PeterJones Oct 4, 2021, 2:58 PM Oct 4, 2021, 2:56 PM

                All,

                For most characters, re-asserting at every tab switch is sufficient.

                However, in my experience, setRepresentation doesn’t work as expected for the CR and LF characters… when I tried editor.setRepresentation("\r", "x"), it gives
                43723f21-7a50-4303-84f2-e6c8f26922b0-image.png

                – it shrinks the box width down to 1 character rather than two, but still tries to say CR instead of x. Similarly, a longer replacement like carriage return allocates enough space for the extras, but still uses the CR text.
                3fb1e0ce-97e5-495b-b707-72201760c41b-image.png

                (the results on \n for LF are similarly ineffective and unhelpful)

                D 1 Reply Last reply Oct 4, 2021, 3:33 PM Reply Quote 2
                • D
                  dail @PeterJones
                  last edited by Oct 4, 2021, 3:33 PM

                  @PeterJones said in Replace line end symbols?:

                  However, in my experience, setRepresentation doesn’t work as expected for the CR and LF characters

                  I had this exact same behavior attempting to do this from LuaScript as well (thought it was a bug in the plugin). Setting it for some other character such as "h" worked but not "\r" or "\n"

                  Newer versions of Scintilla have better support for line end representations. A snippet from the changelog of Scintilla v5.1

                  Add APIs for setting appearance (traditional blob or plain text) and colour of representations and support setting a representation for the “\r\n” line end sequence.

                  P 1 Reply Last reply Oct 4, 2021, 3:52 PM Reply Quote 3
                  • P
                    PeterJones @dail
                    last edited by Oct 4, 2021, 3:52 PM

                    @dail said in Replace line end symbols?:

                    Newer versions of Scintilla have better support for line end representations.

                    … another reason to hope that Don and team are working toward the newer Scintilla in the not-too-distant future. :-)

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