<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to tell that a file is dirty from plugin ( changed without being saved)]]></title><description><![CDATA[<p dir="auto">Hi<br />
I am developing a plugin that edits code that is stored in a DB not in files.<br />
So I have my own opening and saving buttons and want to check and on the state of the document and warn of unsaved changes before they close or re-fetch it from the DB.<br />
What do I do to check if the current scintilla (buffer) has changed and not been saved since loading?</p>
<p dir="auto">I have looked at SCN_MODIFIED notification but did not like having to sort out which file was changing and having to store this in a property for each open file, as well it is firing when loading a document and for each key stroke.</p>
<p dir="auto">Is there an existing property that I can get to or something?</p>
<p dir="auto">Thanks in advance</p>
<p dir="auto">Jeff.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/10842/how-to-tell-that-a-file-is-dirty-from-plugin-changed-without-being-saved</link><generator>RSS for Node</generator><lastBuildDate>Wed, 17 Jun 2026 20:21:19 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/10842.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Nov 2015 01:07:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to tell that a file is dirty from plugin ( changed without being saved) on Wed, 09 Dec 2015 01:20:00 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
Thanks, I am using a different strategy to achieve how to know when to store the changes back into the DB.<br />
I save as a file locally when I open the data from the database. (I did this anyway  so the Tab Caption would have the correct name and to do comparisons with what is in the DB)<br />
I save  the local  file again every time the user saves to the DB<br />
I listen to the notification NPPN_FILEBEFORESAVE and save the data to the database. (user click the Save icon etc)<br />
So if the user closes the application or a file that NPP knows needs saving and NPP asks if the user wants to save then the save is also stored into the DB.</p>
<p dir="auto">Thanks<br />
Jeff</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12497</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12497</guid><dc:creator><![CDATA[Jeff Kelly]]></dc:creator><pubDate>Wed, 09 Dec 2015 01:20:00 GMT</pubDate></item><item><title><![CDATA[Reply to How to tell that a file is dirty from plugin ( changed without being saved) on Fri, 20 Nov 2015 21:33:45 GMT]]></title><description><![CDATA[<p dir="auto">Hi Jeff,</p>
<p dir="auto">unfortunately no. You have to do this with SCN_MODIFIED and keep a list of all open files and their modification stati.</p>
<p dir="auto">You can also use other events such as SciMsg.SCN_SAVEPOINTLEFT, SciMsg.SCN_SAVEPOINTREACHED.</p>
<p dir="auto">For a complete implementation which you can borrow freely have a look at my upcoming plugin:</p>
<p dir="auto"><a href="https://github.com/sanastasiou/RTextNpp/blob/master/RTextNpp/DllExport/UnmanagedExports.cs" rel="nofollow ugc">https://github.com/sanastasiou/RTextNpp/blob/master/RTextNpp/DllExport/UnmanagedExports.cs</a></p>
<p dir="auto">Regards</p>
<p dir="auto">Btw, there is as of today, not a solution for files that have not been saved while NPP was shutdown… In my case, I just delete the backups so that they aren’t saved at all. I explicitly mention this to the users of my plugin because it’s not the default Npp behavior.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/12184</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/12184</guid><dc:creator><![CDATA[sanastasiou]]></dc:creator><pubDate>Fri, 20 Nov 2015 21:33:45 GMT</pubDate></item></channel></rss>