Community

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

    turn on/off the line-ending symbols via script

    Help wanted · · · – – – · · ·
    2
    3
    1564
    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.
    • Alan Kilborn
      Alan Kilborn last edited by

      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:

      1. know the current state (being shown already or not)
      2. set it definitively to ON
      3. 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…

      1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones last edited by PeterJones

        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, or VIEW_TAB_SPACE) as well.

        (And I see the View > Show Symbol keeping in sync…)

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

          FYI, I was also just reminded that @Claudia-Frank, in this other thread, had mentioned the editor.getViewWS() and editor.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 the notepad.menuCommand() based on those editor functions.

          1 Reply Last reply Reply Quote 2
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors