Community
    • Login

    turn on/off the line-ending symbols via script

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 2.2k Views 2 Watching
    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 Offline
      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 Online
        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 Online
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors