diff -r 853685152c1d -r dd0ae1c62a72 ui/common/context.c --- a/ui/common/context.c Sun Nov 12 12:03:50 2017 +0100 +++ b/ui/common/context.c Thu Nov 16 12:04:10 2017 +0100 @@ -218,7 +218,7 @@ break; } case UI_VAR_LIST: { - val = NULL; // TODO + val = ui_list_new(ctx, NULL); break; } case UI_VAR_RANGE: { @@ -241,13 +241,22 @@ return; } + void *fromvalue = from->value; + // update var + if(copytodoc) { + to->from = from; + + from->orig_val = from->value; + from->value = to->value; + } + // copy binding // we don't copy the observer, because the from var has never one switch(from->type) { default: fprintf(stderr, "uic_copy_binding: wtf!\n"); break; case UI_VAR_SPECIAL: break; case UI_VAR_INTEGER: { - UiInteger *f = from->value; + UiInteger *f = fromvalue; UiInteger *t = to->value; if(!f->obj) break; uic_int_copy(f, t); @@ -255,7 +264,7 @@ break; } case UI_VAR_DOUBLE: { - UiDouble *f = from->value; + UiDouble *f = fromvalue; UiDouble *t = to->value; if(!f->obj) break; uic_double_copy(f, t); @@ -263,7 +272,7 @@ break; } case UI_VAR_STRING: { - UiString *f = from->value; + UiString *f = fromvalue; UiString *t = to->value; if(!f->obj) break; uic_string_copy(f, t); @@ -272,7 +281,7 @@ break; } case UI_VAR_TEXT: { - UiText *f = from->value; + UiText *f = fromvalue; UiText *t = to->value; if(!f->obj) break; uic_text_copy(f, t); @@ -282,14 +291,14 @@ break; } case UI_VAR_LIST: { - UiList *f = from->value; + UiList *f = fromvalue; UiList *t = to->value; if(!f->obj) break; uic_list_copy(f, t); t->update(t, -1); } case UI_VAR_RANGE: { - UiRange *f = from->value; + UiRange *f = fromvalue; UiRange *t = to->value; if(!f->obj) break; uic_range_copy(f, t); @@ -298,13 +307,6 @@ t->set(t, t->value); } } - - if(copytodoc) { - to->from = from; - - from->orig_val = from->value; - from->value = to->value; - } } void uic_save_var(UiVar *var) {