turn on/off the line-ending symbols via script
-
Is there a way to turn on and off the visibility of the line-ending symbols via Pythonscript? I can TOGGLE the state by coding this:
notepad.menuCommand(44026)
but I don’t see how I can:
- know the current state (being shown already or not)
- set it definitively to ON
- set it definitively to OFF
Ideas? Thx.
Another thing: When I code it as above, it gets out of sync with the menu option View | Show Symbol | Show End of Line setting. Ideally I’d like something that I can do via Pythonscript that keeps everything in sync…
-
I had experimented with something similar, which I can easily translate into what you want . To guarantee I am in View EOL, I run two commands: first
notepad.menuCommand(MENUCOMMAND.VIEW_ALL_CHARACTERS)
This toggles view all characters first – whether it’s in view all on or off, I now know it is not in view eol. So I can then safely turn it on with a toggle:
notepad.menuCommand(MENUCOMMAND.VIEW_EOL)
Or, in one fell swoop:
notepad.menuCommand(MENUCOMMAND.VIEW_ALL_CHARACTERS) notepad.menuCommand(MENUCOMMAND.VIEW_EOL)
Similarly, to guarantee I toggle view eol off:
notepad.menuCommand(MENUCOMMAND.VIEW_ALL_CHARACTERS) notepad.menuCommand(MENUCOMMAND.VIEW_EOL) notepad.menuCommand(MENUCOMMAND.VIEW_EOL)
You can do something similar for any of the three (
VIEW_EOL
,VIEW_ALL_CHARACTERS
, orVIEW_TAB_SPACE
) as well.(And I see the View > Show Symbol keeping in sync…)
-
FYI, I was also just reminded that @Claudia-Frank, in this other thread, had mentioned the
editor.getViewWS()
andeditor.getViewEOL()
commands, which I keep forgetting. These answer your first step of “know the current state”, so you could base the logic of whether you issue thenotepad.menuCommand()
based on those editor functions.