mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Teaching history how to exit early on thread cancellation
This commit is contained in:
parent
fccf38a4d6
commit
3a7ab3f030
1 changed files with 9 additions and 1 deletions
10
history.cpp
10
history.cpp
|
@ -21,6 +21,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "sanity.h"
|
#include "sanity.h"
|
||||||
#include "tokenizer.h"
|
#include "tokenizer.h"
|
||||||
|
#include "reader.h"
|
||||||
|
|
||||||
#include "wutil.h"
|
#include "wutil.h"
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
|
@ -1010,10 +1011,17 @@ bool history_search_t::go_backwards()
|
||||||
if (idx == max_idx)
|
if (idx == max_idx)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
const bool main_thread = is_main_thread();
|
||||||
|
|
||||||
while (++idx < max_idx)
|
while (++idx < max_idx)
|
||||||
{
|
{
|
||||||
|
if (main_thread ? reader_interrupted() : reader_thread_job_is_stale())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const history_item_t item = history->item_at_index(idx);
|
const history_item_t item = history->item_at_index(idx);
|
||||||
/* We're done if it's empty */
|
/* We're done if it's empty or we cancelled */
|
||||||
if (item.empty())
|
if (item.empty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue