Skip to content

Commit a7270e8

Browse files
authored
Merge pull request #1530 from Yukigaru/fix-listview-jump-over-long-line
[listview] fix jumping over very long lines with Page Up
2 parents 628f2d3 + 2e3bea1 commit a7270e8

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/listview_curses.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,13 @@ listview_curses::handle_key(const ncinput& ch)
297297
{
298298
this->set_selection(0_vl);
299299
} else {
300-
auto shift_amount
301-
= -(this->rows_available(this->lv_top, RD_UP) - 1_vl);
300+
auto rows_avail = this->rows_available(this->lv_top, RD_UP);
301+
if (rows_avail <= 1_vl) {
302+
// may happen in case of jumping over very long lines
303+
// and we need to garantee at least some movement
304+
rows_avail = 2_vl;
305+
}
306+
auto shift_amount = -(rows_avail - 1_vl);
302307
this->shift_top(shift_amount);
303308
}
304309
break;

0 commit comments

Comments
 (0)