From c86264aca8349524711fc7f59cb613012a893ff1 Mon Sep 17 00:00:00 2001 From: Nicholas Velten Date: Mon, 31 Aug 2026 20:38:38 -0300 Subject: [PATCH] [listview] restore scrolling to the top on a second G/End The second press only ever scrolled the last line to the top in the non-selectable branch. Once cursor mode became the default in 7fa4e253, every main view took the selectable branch, which stops after moving the selection, and the behavior disappeared. Give the selectable branch the same second stage: if the selection is already on the last line and it is not at the top yet, scroll it there. --- src/listview_curses.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/listview_curses.cc b/src/listview_curses.cc index 132111eae8..5304e3cd0f 100644 --- a/src/listview_curses.cc +++ b/src/listview_curses.cc @@ -421,7 +421,16 @@ listview_curses::handle_key(const ncinput& ch) auto tail_bottom = this->get_top_for_last_row(); if (this->is_selectable()) { - this->set_selection(last_line); + auto sel = this->get_selection(); + if (sel && sel.value() == last_line + && this->get_top() != last_line) + { + // Already on the last line, so scroll it up to the top, + // matching the behavior in non-cursor mode. + this->set_top(last_line); + } else { + this->set_selection(last_line); + } } else if (this->get_top() == last_line) { this->set_top(tail_bottom); } else if (tail_bottom <= this->get_top()) {