This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efl.

View the commit online.

commit 26c4d84e892c7676d0e9ce2215b225fc0a9a71f2
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Nov 9 17:18:46 2026 -0600

    elementary: select_model: a no-op select cancels nothing in flight
    
    Selecting a row bumped the sequence number that tells a selection by
    index still on its way that something newer was asked, before it saw
    that the row was selected already. A no-op self.selected=true on the
    selected row therefore dropped the index selection in flight.
    
    Bump it after the no-change return.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/elementary/efl_ui_select_model.c        |  7 +++-
 src/tests/elementary/efl_ui_test_select_model.c | 49 +++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/src/lib/elementary/efl_ui_select_model.c b/src/lib/elementary/efl_ui_select_model.c
index 543c498cbb..e84fac06dd 100644
--- a/src/lib/elementary/efl_ui_select_model.c
+++ b/src/lib/elementary/efl_ui_select_model.c
@@ -427,12 +427,17 @@ _efl_ui_select_model_efl_model_property_set(Eo *obj,
         // row, and those unselects arrive once the mode is none
         if ((pd->parent->selection == EFL_UI_SELECT_MODE_NONE) && newflag)
           return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
-        if (newflag) pd->parent->select_seq++;
 
         // Nothing changed
         if (newflag == prevflag)
           return efl_loop_future_resolved(obj, eina_value_bool_init(newflag));
 
+        // (a select that changes nothing does not take the place of one by index in flight)
+        if (newflag)
+          {
+             pd->parent->select_seq++;
+          }
+
         /* Refusing to be the change that leaves nothing selected, which is
            what allow_manual_deselection is for. Refused before the value is
            stored rather than undone afterwards, so the selection is never
diff --git a/src/tests/elementary/efl_ui_test_select_model.c b/src/tests/elementary/efl_ui_test_select_model.c
index 12cdfb65f7..bef69de55e 100644
--- a/src/tests/elementary/efl_ui_test_select_model.c
+++ b/src/tests/elementary/efl_ui_test_select_model.c
@@ -729,6 +729,54 @@ EFL_START_TEST(efl_test_select_model_single_later_direct_select_wins)
 }
 EFL_END_TEST
 
+// Single mode: selecting a row that is the selected one already changes nothing, and
+// so does not cancel a selection by index that was asked for and is on its way.
+EFL_START_TEST(efl_test_select_model_noop_select_keeps_index_select)
+{
+   Efl_Model *base_model, *model;
+   Eo *kids[2] = { NULL, NULL };
+   Eina_Value select = eina_value_bool_init(EINA_TRUE);
+   unsigned int i, first = 99;
+
+   base_model = efl_add_ref(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
+   for (i = 0; i < 10; ++i)
+     {
+        ck_assert(!!efl_model_child_add(base_model));
+     }
+   model = efl_add_ref(EFL_UI_SELECT_MODEL_CLASS, efl_main_loop_get(),
+                       efl_ui_view_model_set(efl_added, base_model));
+   efl_ui_multi_selectable_select_mode_set(model, EFL_UI_SELECT_MODE_SINGLE);
+   eina_future_then(efl_model_children_slice_get(model, 2, 1), _gone_then, kids, NULL);
+   for (i = 0; (i < 12) && !kids[0]; i++)
+     {
+        ecore_main_loop_iterate();
+     }
+   ck_assert(!!kids[0]);
+   eina_future_then(efl_model_property_set(kids[0], "self.selected", &select),
+                    _state_ignore, NULL, NULL);
+   for (i = 0; i < 12; i++)
+     {
+        ecore_main_loop_iterate();
+     }
+   ck_assert_int_eq(_selected_count(model, &first), 1);
+   ck_assert_int_eq(first, 2);
+
+   efl_ui_multi_selectable_ndx_range_select(model, 5, 5);
+   eina_future_then(efl_model_property_set(kids[0], "self.selected", &select),
+                    _state_ignore, NULL, NULL);
+   for (i = 0; i < 12; i++)
+     {
+        ecore_main_loop_iterate();
+     }
+   ck_assert_int_eq(_selected_count(model, &first), 1);
+   ck_assert_int_eq(first, 5);
+
+   efl_unref(kids[0]);
+   efl_unref(model);
+   efl_unref(base_model);
+}
+EFL_END_TEST
+
 void
 efl_ui_test_select_model(TCase *tc)
 {
@@ -744,4 +792,5 @@ efl_ui_test_select_model(TCase *tc)
    tcase_add_test(tc, efl_test_select_model_single_to_none_unselects_all);
    tcase_add_test(tc, efl_test_select_model_manual_deselection);
    tcase_add_test(tc, efl_test_select_model_single_later_direct_select_wins);
+   tcase_add_test(tc, efl_test_select_model_noop_select_keeps_index_select);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to