Community
    • Login

    How to programmatically determine if a bookmark is set for a given line number?

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    4 Posts 2 Posters 939 Views 1 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.
    • Paul BakerP Offline
      Paul Baker
      last edited by

      Is there a way to programmatically set or clear a bookmark? I don’t want to toggle the bookmark. I want to set it if it is not already set.

      I have found these message types.

          #define    IDM_SEARCH_TOGGLE_BOOKMARK      (IDM_SEARCH + 5)
          #define    IDM_SEARCH_NEXT_BOOKMARK        (IDM_SEARCH + 6)
          #define    IDM_SEARCH_PREV_BOOKMARK        (IDM_SEARCH + 7)
          #define    IDM_SEARCH_CLEAR_BOOKMARKS      (IDM_SEARCH + 8)
      

      I want to check if a bookmark is set for the current line. If it is, then no additional action needed, if not set then I want to set it.

      Is this possible?

      Thank You!
      Paul

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @Paul Baker
        last edited by

        @Paul-Baker said in How to programmatically determine if a bookmark is set for a given line number?:

        Is there a way to programmatically set or clear a bookmark?

        Of course. :-)

        “Markers” are a Scintilla function, so I’ll refer you to Scintilla docs for markers HERE.

        N++ uses marker ID 20 for bookmarks.
        You can search the N++ source code for MARK_BOOKMARK to see some implementation.

        Paul BakerP 1 Reply Last reply Reply Quote 1
        • Paul BakerP Offline
          Paul Baker @Alan Kilborn
          last edited by

          @Alan-Kilborn said in How to programmatically determine if a bookmark is set for a given line number?:

          Of course. :-)

          “Markers” are a Scintilla function, so I’ll refer you to Scintilla docs for markers HERE .

          N++ uses marker ID 20 for bookmarks.
          You can search the N++ source code for MARK_BOOKMARK to see some implementation.

          Thank you Alan. Everyone on this forum is so helpful. I’ll check out the doc and look for the implementations.

          -Paul

          Paul BakerP 1 Reply Last reply Reply Quote 1
          • Paul BakerP Offline
            Paul Baker @Paul Baker
            last edited by

            @Paul-Baker

            The c# template I am using had these already defined… Not sure how I missed this. But thanks again!

            /// <summary>Add a marker to a line, returning an ID which can be used to find or delete the marker. (Scintilla feature 2043)</summary>
                    int MarkerAdd(int line, int markerNumber);
            
                    /// <summary>Delete a marker from a line. (Scintilla feature 2044)</summary>
                    void MarkerDelete(int line, int markerNumber);
            
                    /// <summary>Delete all markers with a particular number from all lines. (Scintilla feature 2045)</summary>
                    void MarkerDeleteAll(int markerNumber);
            
                    /// <summary>Get a bit mask of all the markers set on a line. (Scintilla feature 2046)</summary>
                    int MarkerGet(int line);
            
            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