mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-26 11:45:08 +00:00
Add some more cancellability to autosuggestions
This commit is contained in:
parent
94acb6ed5d
commit
c6302e3b3f
1 changed files with 9 additions and 2 deletions
11
reader.cpp
11
reader.cpp
|
@ -1298,7 +1298,7 @@ struct autosuggestion_context_t
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (searcher.go_backwards())
|
while (! reader_thread_job_is_stale() && searcher.go_backwards())
|
||||||
{
|
{
|
||||||
history_item_t item = searcher.current_item();
|
history_item_t item = searcher.current_item();
|
||||||
|
|
||||||
|
@ -1312,9 +1312,12 @@ struct autosuggestion_context_t
|
||||||
this->autosuggestion = searcher.current_string();
|
this->autosuggestion = searcher.current_string();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Maybe cancel here */
|
||||||
|
if (reader_thread_job_is_stale())
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* Try handling a special command like cd */
|
/* Try handling a special command like cd */
|
||||||
wcstring special_suggestion;
|
wcstring special_suggestion;
|
||||||
if (autosuggest_suggest_special(search_string, working_directory, special_suggestion))
|
if (autosuggest_suggest_special(search_string, working_directory, special_suggestion))
|
||||||
|
@ -1323,6 +1326,10 @@ struct autosuggestion_context_t
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Maybe cancel here */
|
||||||
|
if (reader_thread_job_is_stale())
|
||||||
|
return 0;
|
||||||
|
|
||||||
// Here we do something a little funny
|
// Here we do something a little funny
|
||||||
// If the line ends with a space, and the cursor is not at the end,
|
// If the line ends with a space, and the cursor is not at the end,
|
||||||
// don't use completion autosuggestions. It ends up being pretty weird seeing stuff get spammed on the right
|
// don't use completion autosuggestions. It ends up being pretty weird seeing stuff get spammed on the right
|
||||||
|
|
Loading…
Reference in a new issue