Community
    • Login

    turn on/off the line-ending symbols via script

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.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.
    • Alan KilbornA
      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
      • PeterJonesP
        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
        • PeterJonesP
          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
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors