--- a/ui/common/context.c Tue Feb 25 21:11:00 2025 +0100 +++ b/ui/common/context.c Sat Apr 05 16:46:11 2025 +0200 @@ -139,8 +139,8 @@ void uic_context_detach_document2(UiContext *ctx, void *document) { // find the document in the documents list - ssize_t docIndex = cxListFind(ctx->documents, document); - if(docIndex < 0) { + size_t docIndex = cxListFind(ctx->documents, document); + if(!cxListIndexValid(ctx->documents, docIndex)) { return; } @@ -292,6 +292,8 @@ to->from_ctx = from->from_ctx; } + ui_setop_enable(TRUE); + // copy binding // we don't copy the observer, because the from var has never one switch(from->type) { @@ -327,9 +329,7 @@ UiText *t = to->value; if(!f->obj) break; uic_text_copy(f, t); - char *tvalue = t->value.ptr ? t->value.ptr : ""; - t->set(t, tvalue); - t->setposition(t, t->pos); + t->restore(t); break; } case UI_VAR_LIST: { @@ -349,7 +349,10 @@ *to = tmp; UiList* t2 = to->value; - ui_notify(t2->observers, NULL); + if(t->update) { + t->update(t, -1); + } + ui_notify(t2->observers, NULL); // TODO: why not t? break; } @@ -372,6 +375,8 @@ break; } } + + ui_setop_enable(FALSE); } void uic_save_var2(UiVar *var) {