Replace line end symbols?



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



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



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



  • @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! :-)



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



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



  • 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)



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



  • @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. :-)


Log in to reply