Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Replace line end symbols?

    General Discussion
    7
    9
    278
    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.
    • vanowm
      vanowm last edited by

      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
      • gstavi
        gstavi last edited by

        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.

        astewart77 1 Reply Last reply Reply Quote 0
        • astewart77
          astewart77 @gstavi last edited by

          @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.

          Alan Kilborn Michael Vincent 2 Replies Last reply Reply Quote 1
          • Alan Kilborn
            Alan Kilborn @astewart77 last edited by

            @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
            • Michael Vincent
              Michael Vincent @astewart77 last edited by

              @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.

              Alan Kilborn 1 Reply Last reply Reply Quote 1
              • Alan Kilborn
                Alan Kilborn @Michael Vincent last edited by

                @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.

                PeterJones 1 Reply Last reply Reply Quote 1
                • PeterJones
                  PeterJones @Alan Kilborn last edited by PeterJones

                  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)

                  dail 1 Reply Last reply Reply Quote 2
                  • dail
                    dail @PeterJones last edited by

                    @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.

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

                      @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
                      • First post
                        Last post
                      Copyright © 2014 NodeBB Forums | Contributors