From c9ae33f1ae60e592bdca62f57d5b6b58672be169 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Sat, 3 May 2025 21:54:15 +0200 Subject: [PATCH] add newly created notes to the notes list and not when they are saved the first time --- application/note.c | 5 ----- application/notebook.c | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/application/note.c b/application/note.c index c1d1bf4..ffa0d94 100644 --- a/application/note.c +++ b/application/note.c @@ -198,11 +198,6 @@ void note_save(UiObject *obj, NotebookModel *notebook, Resource *note) { if(note->resource_id == 0) { // new note note_store_new_note_async(obj, note, NULL, NULL); - notebook->disable_selection_events = TRUE; - int index = notebook->notes->count(notebook->notes); - ui_list_append(notebook->notes, note); - notebook->notes->update(notebook->notes, index); - notebook->disable_selection_events = FALSE; } else { note_store_save_note_async(obj, note, NULL, NULL); } diff --git a/application/notebook.c b/application/notebook.c index 14140da..5b92dd3 100644 --- a/application/notebook.c +++ b/application/notebook.c @@ -206,6 +206,9 @@ void notebookmodel_new_note(NotebookModel *model) { // initialize note content // possible to implement something like note templates here editor_load_markdown(new_note, model->window->textview, cx_mutstrn("", 0)); + + ui_list_append(model->notes, new_note); + ui_list_update(model->notes); } typedef struct NoteDeleteOp { -- 2.43.5