how to get current file status saved or not c# NPPN_FILESAVED



  • Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETCURRENTDIRECTORY, 0, path);

            Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_SAVECURRENTFILE, 0, savedornot);
    
            Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPN_FILESAVED, 0, out path);




  • @gurikbal-singh NPPN… are notifications send by notepad++ to subscribers(plugins) and NPPM… are messages send by plugins to
    notepad++.

    In order to find out what the current status is, I assume, the following needs to be done.
    On npp startup check the status of open buffers with their representation on disk and during runtime
    handle the different notifications accordingly.



  • @Eko-palypse said:

    @gurikbal-singh NPPN… are notifications send by notepad++ to subscribers(plugins) and NPPM… are messages send by plugins to
    notepad++.

    In order to find out what the current status is, I assume, the following needs to be done.
    On npp startup check the status of open buffers with their representation on disk and during runtime
    handle the different notifications accordingly.

    yes i got a message through UnmanagedExports.cs getting NPPN_FILESAVED
    but this is only correspond while save button is clicked

    there are no option example IDM_FILE_SAVEENABED
    actually my question is “how to get current file status saved or not”



  • @gurikbal-singh

    afaik, there is no npp api function available to find out if a file is dirty or not.
    As said, you can either compare the current buffer with the file on disk
    or check the menu save item if it is disabled or enabled.


Log in to reply