mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
Fix "commandline --paging-mode" false negative when there is no room for pager, attempt 2
The previous fix was reverted because it broke another scenario. Add tests for both scenarios. The first test exposes another problem: autosuggestions are sometimes not recomputed after selecting the first completion with Tab Tab. Fix that too.
This commit is contained in:
parent
7b18a70724
commit
095c093af6
|
@ -1978,7 +1978,7 @@ void reader_data_t::update_autosuggestion() {
|
||||||
// This is also the main mechanism by which readline commands that don't change the command line
|
// This is also the main mechanism by which readline commands that don't change the command line
|
||||||
// text avoid recomputing the autosuggestion.
|
// text avoid recomputing the autosuggestion.
|
||||||
const editable_line_t &el = command_line;
|
const editable_line_t &el = command_line;
|
||||||
if (!autosuggestion.empty() &&
|
if (autosuggestion.text.size() > el.text().size() &&
|
||||||
(autosuggestion.icase
|
(autosuggestion.icase
|
||||||
? string_prefixes_string_case_insensitive(el.text(), autosuggestion.text)
|
? string_prefixes_string_case_insensitive(el.text(), autosuggestion.text)
|
||||||
: string_prefixes_string(el.text(), autosuggestion.text))) {
|
: string_prefixes_string(el.text(), autosuggestion.text))) {
|
||||||
|
@ -2913,7 +2913,7 @@ void reader_data_t::update_commandline_state() const {
|
||||||
snapshot->cursor_pos = this->command_line.position();
|
snapshot->cursor_pos = this->command_line.position();
|
||||||
snapshot->history = this->history;
|
snapshot->history = this->history;
|
||||||
snapshot->selection = this->get_selection();
|
snapshot->selection = this->get_selection();
|
||||||
snapshot->pager_mode = !this->current_page_rendering.screen_data.empty();
|
snapshot->pager_mode = !this->pager.empty();
|
||||||
snapshot->pager_fully_disclosed = this->current_page_rendering.remaining_to_disclose == 0;
|
snapshot->pager_fully_disclosed = this->current_page_rendering.remaining_to_disclose == 0;
|
||||||
snapshot->search_mode = this->history_search.active();
|
snapshot->search_mode = this->history_search.active();
|
||||||
snapshot->initialized = true;
|
snapshot->initialized = true;
|
||||||
|
|
|
@ -48,3 +48,23 @@ isolated-tmux send-keys C-l foo2 Space BTab b BSpace b Escape
|
||||||
tmux-sleep
|
tmux-sleep
|
||||||
isolated-tmux capture-pane -p
|
isolated-tmux capture-pane -p
|
||||||
# CHECK: prompt 3> foo2 aa
|
# CHECK: prompt 3> foo2 aa
|
||||||
|
|
||||||
|
# Check that down-or-search works even when the pager is not selected.
|
||||||
|
isolated-tmux send-keys C-u foo2 Space Tab
|
||||||
|
tmux-sleep
|
||||||
|
isolated-tmux send-keys Down
|
||||||
|
tmux-sleep
|
||||||
|
isolated-tmux capture-pane -p
|
||||||
|
# Also check that we show an autosuggestion.
|
||||||
|
# CHECK: prompt 3> foo2 aabc aabc
|
||||||
|
# CHECK: aabc{{ *}}aaBd
|
||||||
|
|
||||||
|
# Check that a larger-than-screen completion does not break down-or-search.
|
||||||
|
isolated-tmux send-keys C-u 'complete -c foo4 -f -a "
|
||||||
|
a-long-arg-\"$(seq $LINES | string pad -c_ --width $COLUMNS)\"
|
||||||
|
b-short-arg"' Enter C-l foo4 Space Tab Tab Down
|
||||||
|
tmux-sleep
|
||||||
|
isolated-tmux capture-pane -p | head -1
|
||||||
|
# The second one is the autosuggestion. Maybe we should turn them off for this test.
|
||||||
|
# TODO there should be a prefix ("prompt 4> foo4") but we fail to draw that in this case.
|
||||||
|
# CHECK: {{.*}} b-short-arg a-long-arg{{.*}}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user