]> uap-core.de Git - note.git/commitdiff
save note when it is detached
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 3 Mar 2025 21:19:40 +0000 (22:19 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 3 Mar 2025 21:19:40 +0000 (22:19 +0100)
application/notebook.c

index 106bb141d507315466b8819728a1d7cdbbe302df..29828776e7eb14c6a7611562105042fba76c3ac9 100644 (file)
@@ -139,8 +139,13 @@ void notebookmodel_attach_note(NotebookModel *model, Note *note) {
 }
 
 void notebookmodel_detach_current_note(NotebookModel *model) {
-    if(model->current_note && model->current_note->model) {
-        ui_detach_document2(model->ctx, model->current_note->model);
+    if(model->current_note) {
+        if(model->current_note->model->modified) {
+            note_save(model->window->obj, model, model->current_note);
+        }
+        if(model->current_note->model) {
+            ui_detach_document2(model->ctx, model->current_note->model);
+        }
         model->current_note = NULL;
     }
 }