notepad: don't prompt to save empty Untitled file

Henry Kroll III henry at comptune.com
Sat Mar 6 23:05:21 CST 2010


Don't prompt to save empty text buffer upon closing, unless a file is
actually being edited. This is the expected behavior on XP.
-------------- next part --------------
diff --git a/programs/notepad/dialog.c b/programs/notepad/dialog.c
index 45d0c75..6400e90 100644
--- a/programs/notepad/dialog.c
+++ b/programs/notepad/dialog.c
@@ -297,7 +297,9 @@ BOOL DoCloseFile(void)
     int nResult;
     static const WCHAR empty_strW[] = { 0 };
 
-    if (SendMessageW(Globals.hEdit, EM_GETMODIFY, 0, 0))
+    nResult=GetWindowTextLengthW(Globals.hEdit);
+    if (SendMessageW(Globals.hEdit, EM_GETMODIFY, 0, 0)
+	&&(nResult||Globals.szFileName[0]))
     {
         /* prompt user to save changes */
         nResult = AlertFileNotSaved(Globals.szFileName);


More information about the wine-patches mailing list