From bafc958a9210a15ff5d206491f9fd634201ce7b8 Mon Sep 17 00:00:00 2001 From: Sadrul Habib Chowdhury Date: Tue, 23 Feb 2010 14:43:04 -0500 Subject: Fix the unexpected selection-change bug. Do not remove a row from the list if it is already in the correct position. --- src/list_window.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/list_window.c b/src/list_window.c index 05a42b7..2313cbf 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -434,9 +434,17 @@ WListUpdate(struct win *p, struct ListData *ldata) else rbefore = NULL; - /* For now, just remove the row containing 'p'. */ - gl_Window_remove(ldata, p); - glist_add_row(ldata, p, rbefore); + /* For now, just remove the row containing 'p' if it is not already in the right place . */ + row = gl_Window_findrow(ldata, p); + if (row) + { + if (row->prev != rbefore) + gl_Window_remove(ldata, p); + else + p = NULL; /* the window is in the correct place */ + } + if (p) + glist_add_row(ldata, p, rbefore); glist_display_all(ldata); } -- cgit v1.2.1