# HG changeset patch # User Olaf Wintermann # Date 1753816549 -7200 # Node ID ba226c243f3f96942f8b39c6e043733df752e89c # Parent 326e7a5122fabf9f638fc395df05153a569736ed fix listview row update loses selection (GTK) diff -r 326e7a5122fa -r ba226c243f3f ui/gtk/list.c --- a/ui/gtk/list.c Tue Jul 29 21:12:04 2025 +0200 +++ b/ui/gtk/list.c Tue Jul 29 21:15:49 2025 +0200 @@ -626,14 +626,20 @@ void *value = list->get(list, i); if(value) { ObjWrapper *obj = obj_wrapper_new(value, i); + UiListSelection sel = list->getselection(list); // TODO: if index i is selected, the selection is lost // is it possible to update the item without removing it? + // workaround: save selection and reapply it int count = g_list_model_get_n_items(G_LIST_MODEL(view->liststore)); if(count <= i) { g_list_store_splice(view->liststore, i, 0, (void **)&obj, 1); } else { g_list_store_splice(view->liststore, i, 1, (void **)&obj, 1); } + if(sel.count > 0) { + list->setselection(list, sel); + } + ui_listselection_free(sel); } } }