From fbe30cb7f51491924b69b27ea44da6868c530848 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Sat, 25 Oct 2025 20:54:23 +0200 Subject: [PATCH] switching notebooks will save the current note --- application/notebook.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/application/notebook.c b/application/notebook.c index e3e45ec..2b08f42 100644 --- a/application/notebook.c +++ b/application/notebook.c @@ -78,20 +78,18 @@ void notebookmodel_attach(MainWindow *window, NotebookModel *model) { } void notebookmodel_detach(NotebookModel *model) { - // TODO: workaround for a toolkit bug, that reattaching a document - // that has sub-documents will not update all bindings if(model->current_note) { - //int i = ui_get(model->current_note->model->type); - //printf("type: %d\n", i); + // TODO: model->modified doesnt work yet, remove || 1 when it works + if(model->current_note->model->modified || 1) { + note_save(model->window->obj, model, model->current_note); + } + + // TODO: workaround for a toolkit bug, that reattaching a document + // with sub-documents will not update all bindings ui_detach_document(model->ctx, model->current_note->model); model->current_note = NULL; } - if(model->current_note && model->current_note->model->modified) { - //notebookmodel_detach_current_note(model); - note_save(model->window->obj, model, model->current_note); - } - if(model->window) { ui_detach_document(model->window->obj->ctx, model); model->window->current_notebook = NULL; -- 2.47.3