From edd2c13b6f9ae61f9e14ea2ee41a1952a5c7dac5 Mon Sep 17 00:00:00 2001
From: Jed Barber <jjbarber@y7mail.com>
Date: Mon, 19 Sep 2016 20:12:07 +1000
Subject: Fixed bug where data lost upon save file failure when quit/new/open
 selected

---
 src/adapad.adb | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/adapad.adb b/src/adapad.adb
index 20d5ba4..f7561dc 100644
--- a/src/adapad.adb
+++ b/src/adapad.adb
@@ -94,7 +94,9 @@ function AdaPad return Integer is
     begin
         case Cancel_Save_Discard is
             when First => return;
-            when Second => Save_CB.Call (Item);
+            when Second =>
+                Save_CB.Call (Item);
+                if Changed then return; end if;
             when Third => null;
         end case;
         Filename := To_Unbounded_String (0);
@@ -116,7 +118,9 @@ function AdaPad return Integer is
     begin
         case Cancel_Save_Discard is
             when First => return;
-            when Second => Save_CB.Call (Item);
+            when Second =>
+                Save_CB.Call (Item);
+                if Changed then return; end if;
             when Third => null;
         end case;
         declare
@@ -140,7 +144,9 @@ function AdaPad return Integer is
     begin
         case Cancel_Save_Discard is
             when First => return;
-            when Second => Save_CB.Call (Item);
+            when Second =>
+                Save_CB.Call (Item);
+                if Changed then return; end if;
             when Third => null;
         end case;
         This.Editor.Hide;
-- 
cgit