From d155c3559f7801825a2326b4186b3c7d18c23214 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 16 Oct 2013 15:04:49 +0300 Subject: [PATCH] Make List::set_selected_index a no-op if that item was already selected --- source/list.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/list.cpp b/source/list.cpp index b712574..653a40c 100644 --- a/source/list.cpp +++ b/source/list.cpp @@ -141,11 +141,14 @@ void List::set_selected_index(int i) if(i>=static_cast(data->size())) throw out_of_range("List::set_selected_index"); + if(i==sel_index) + return; + if(sel_index>=0) items[sel_index]->set_active(false); if(i<0) sel_index = -1; - else if(i!=sel_index) + else { sel_index = i; items[sel_index]->set_active(true); -- 2.43.0