From 08040b011b683e98361fc9426fa843a9a4d2447c Mon Sep 17 00:00:00 2001 From: eidheim Date: Sat, 6 Mar 2021 23:15:21 +0100 Subject: [PATCH] Selection dialog now also wraps arround navigation --- src/selection_dialog.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/selection_dialog.cpp b/src/selection_dialog.cpp index fc6ba80..ea68c91 100644 --- a/src/selection_dialog.cpp +++ b/src/selection_dialog.cpp @@ -269,6 +269,8 @@ bool SelectionDialog::on_key_press(GdkEventKey *event) { it++; if(it) list_view_text.set_cursor(list_view_text.get_model()->get_path(it)); + else + list_view_text.set_cursor(list_view_text.get_model()->get_path(list_view_text.get_model()->children().begin())); } return true; } @@ -278,6 +280,12 @@ bool SelectionDialog::on_key_press(GdkEventKey *event) { it--; if(it) list_view_text.set_cursor(list_view_text.get_model()->get_path(it)); + else { + auto last_it = list_view_text.get_model()->children().end(); + last_it--; + if(last_it) + list_view_text.set_cursor(list_view_text.get_model()->get_path(last_it)); + } } return true; }