mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00: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
2 changed files with 6 additions and 5 deletions
|
@ -608,16 +608,17 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
|
||||||
case direction_south:
|
case direction_south:
|
||||||
case direction_page_south:
|
case direction_page_south:
|
||||||
case direction_next:
|
case direction_next:
|
||||||
|
case direction_north:
|
||||||
case direction_prev: {
|
case direction_prev: {
|
||||||
// These directions do something sane.
|
// These directions do something sane.
|
||||||
if (direction == direction_prev) {
|
if (direction == direction_prev
|
||||||
|
|| direction == direction_north) {
|
||||||
selected_completion_idx = completion_infos.size() - 1;
|
selected_completion_idx = completion_infos.size() - 1;
|
||||||
} else {
|
} else {
|
||||||
selected_completion_idx = 0;
|
selected_completion_idx = 0;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case direction_north:
|
|
||||||
case direction_page_north:
|
case direction_page_north:
|
||||||
case direction_east:
|
case direction_east:
|
||||||
case direction_west:
|
case direction_west:
|
||||||
|
|
|
@ -2970,9 +2970,9 @@ const wchar_t *reader_readline(int nchars) {
|
||||||
|
|
||||||
// Now do the selection.
|
// Now do the selection.
|
||||||
select_completion_in_direction(direction);
|
select_completion_in_direction(direction);
|
||||||
} else if (c == R_DOWN_LINE && !data->pager.empty()) {
|
} else if (!data->pager.empty()) {
|
||||||
// We pressed down with a non-empty pager contents, begin navigation.
|
// We pressed a direction with a non-empty pager, begin navigation.
|
||||||
select_completion_in_direction(direction_south);
|
select_completion_in_direction(c == R_DOWN_LINE ? direction_south : direction_north);
|
||||||
} else {
|
} else {
|
||||||
// Not navigating the pager contents.
|
// Not navigating the pager contents.
|
||||||
editable_line_t *el = data->active_edit_line();
|
editable_line_t *el = data->active_edit_line();
|
||||||
|
|
Loading…
Reference in a new issue