Community
    • Login

    SCN_SAVEPOINTLEFT

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    7 Posts 3 Posters 8.6k 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.
    • fstellariF
      fstellari
      last edited by

      I’m having a problem retrieving the document index and view.

      If I use the code below I get a view=3 and index=very large number.

      Any idea?

      const UINT nBufferPos = SendMessage(nppData._nppHandle, NPPM_GETPOSFROMBUFFERID, notifyCode->nmhdr.idFrom, 0);
      const UINT nView = nBufferPos >> 30;
      const UINT nIndex = (nBufferPos << 2) >> 2;

      1 Reply Last reply Reply Quote 0
      • dailD
        dail
        last edited by

        I would make sure nBufferPos != -1. I don’t think notifyCode->nmhdr.idFrom is supposed to hold the buffer ID is it?

        1 Reply Last reply Reply Quote 0
        • fstellariF
          fstellari
          last edited by

          I see you point.
          I assumed that it would work similarly to NPPN_FILEOPENED.

          How can I figure out which buffer caused the notification?

          Thank you for your help,

          Franco

          1 Reply Last reply Reply Quote 0
          • dailD
            dail
            last edited by

            The major difference is that SCN_SAVEPOINTLEFT is a notification from Scintilla and does not know anything about buffer IDs, whereas NPPN_FILEOPENED is generated by Notepad++ and has access to the buffer ID. You will probably have to use NPPM_GETCURRENTBUFFERID .

            1 Reply Last reply Reply Quote 0
            • fstellariF
              fstellari
              last edited by

              Buffer causing the notification may not be the current buffer.

              1 Reply Last reply Reply Quote 0
              • dailD
                dail
                last edited by

                Ah! Yeah that’s what I was kind of afraid of. Looking at the API it doesn’t look like there is a way to do that. I guess you maybe able to instead catch NPPN_BUFFERACTIVATED and then use SCI_GETMODIFY to see if it is in a “saved” state or not…but depending on what the plugin needs to do this may not work since you have to wait for the unsaved buffer to get activated…

                1 Reply Last reply Reply Quote 0
                • sanastasiouS
                  sanastasiou
                  last edited by

                  There’s also a problem here, with the “unsaved” files after closing Npp. Npp knows that some files were unsaved because it saves copies of them. However SCI_GETMODIFY reports that no changes have been made to the files once you reopen them. It would have been really helpful, if this was consistent with the small “save” icon on top of the tab.

                  It would even be more helpful, so simply be able to ask NPP “isFileDirty” i.e. get the status of the “save” button somehow.

                  Right now, I have to duplicate all the work the NPP does, i.e. chekc if there’s a copy of the file saved upon opening etc.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors