@@ -480,11 +480,15 @@ public class Main : Window {
480480 }
481481
482482 private void noteSelected (TreeSelection treeSelection ) {
483- if (this .loadingNotes || this . saveRequested ) {
484- Zystem .debug ("Ignoring note selected due to loadingNotes || saveRequested . lastLoadRequestType: " + this .filter .lastLoadRequestType .to_string ());
483+ if (this .loadingNotes ) {
484+ Zystem .debug ("Ignoring note selected due to loadingNotes. lastLoadRequestType: " + this .filter .lastLoadRequestType .to_string ());
485485 return ;
486486 }
487487
488+ if (this .saveRequested ) {
489+ this .saveNonAsync (); // Trying this to call save on current note before changing it.
490+ }
491+
488492 TreeModel model ;
489493 TreeIter iter ;
490494 treeSelection .get_selected (out model , out iter );
@@ -809,6 +813,11 @@ public class Main : Window {
809813 }
810814
811815 private void createNewNote () {
816+ if (this .saveRequested ) {
817+ this .saveNonAsync (); // Trying this to call save on current note before changing it.
818+ //return; // Don't create new note if waiting for current note to save.
819+ }
820+
812821 this .note = new Note ("" );
813822 this .needsSave = false;
814823 this .isOpening = true;
@@ -990,6 +999,14 @@ public class Main : Window {
990999 this .resetNotesView ();
9911000 }
9921001
1002+ private void saveNonAsync () {
1003+ this .saveRequested = false;
1004+ if (this .timerId != 0 ) {
1005+ Source .remove (this .timerId );
1006+ }
1007+ this .note .save (this .editor .getText ());
1008+ }
1009+
9931010 /**
9941011 * Quit P.S. Notes.
9951012 */
@@ -999,7 +1016,7 @@ public class Main : Window {
9991016 if (this .saveRequested && this .timerId != 0 ) {
10001017 Source .remove (this .timerId );
10011018
1002- this .note . save ( this . editor . getText () );
1019+ this .saveNonAsync ( );
10031020 }
10041021
10051022 // Save window size
0 commit comments