From 14524d8e1dcb60b58ddbd117d19298b19255d1f3 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 29 Jan 2013 21:26:07 +1100 Subject: [PATCH] Fix cursor up/down logic The dive selection rewrite didn't set the selected dive index, breaking the cursor key logic. Reported-by: Dirk Hohndel Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- divelist.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/divelist.c b/divelist.c index b31c9ac25..440c88922 100644 --- a/divelist.c +++ b/divelist.c @@ -2595,11 +2595,13 @@ static void sort_column_change_cb(GtkTreeSortable *treeview, gpointer data) } } -static void select_dive(struct dive *dive) +static void select_dive(int idx) { + struct dive *dive = get_dive(idx); if (dive && !dive->selected) { dive->selected = 1; amount_selected++; + selected_dive = idx; } } @@ -2624,10 +2626,10 @@ static void entry_selected(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter * /* Otherwise, consider each dive under it selected */ for_each_dive(i, dive) { if (dive->divetrip == trip) - select_dive(dive); + select_dive(i); } } else { - select_dive(get_dive(idx)); + select_dive(idx); } }