mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 13:33:02 +08:00
[Pager] Make up without selected contents jump back into the pager
This makes it possible to select the last element of the completions with just one keypress. Fixes #3115.
This commit is contained in:
parent
13079911bc
commit
dc95bfc1b1
|
@ -608,16 +608,17 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
|
|||
case direction_south:
|
||||
case direction_page_south:
|
||||
case direction_next:
|
||||
case direction_north:
|
||||
case direction_prev: {
|
||||
// These directions do something sane.
|
||||
if (direction == direction_prev) {
|
||||
if (direction == direction_prev
|
||||
|| direction == direction_north) {
|
||||
selected_completion_idx = completion_infos.size() - 1;
|
||||
} else {
|
||||
selected_completion_idx = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case direction_north:
|
||||
case direction_page_north:
|
||||
case direction_east:
|
||||
case direction_west:
|
||||
|
|
|
@ -2970,9 +2970,9 @@ const wchar_t *reader_readline(int nchars) {
|
|||
|
||||
// Now do the selection.
|
||||
select_completion_in_direction(direction);
|
||||
} else if (c == R_DOWN_LINE && !data->pager.empty()) {
|
||||
// We pressed down with a non-empty pager contents, begin navigation.
|
||||
select_completion_in_direction(direction_south);
|
||||
} else if (!data->pager.empty()) {
|
||||
// We pressed a direction with a non-empty pager, begin navigation.
|
||||
select_completion_in_direction(c == R_DOWN_LINE ? direction_south : direction_north);
|
||||
} else {
|
||||
// Not navigating the pager contents.
|
||||
editable_line_t *el = data->active_edit_line();
|
||||
|
|
Loading…
Reference in New Issue
Block a user