summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-02-23 14:43:04 -0500
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-02-23 14:43:04 -0500
commitbafc958a9210a15ff5d206491f9fd634201ce7b8 (patch)
tree48337b86e21adbbc0886b361fd90aaa0b342265f
parentd9262fc5897e54f1b1fc1874acf101811bbb5935 (diff)
downloadscreen-bafc958a9210a15ff5d206491f9fd634201ce7b8.tar.gz
Fix the unexpected selection-change bug.
Do not remove a row from the list if it is already in the correct position.
-rw-r--r--src/list_window.c14
1 files 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);
}