aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-04-07 16:40:14 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-04-07 16:40:14 -0700
commitc6302e3b3fba21f426720f75d411687221f85e13 (patch)
tree16abaab7a50e630b3fcef18301332ad4cb200130 /reader.cpp
parent94acb6ed5d8ae67565605d57f7d55a5ea4888e1c (diff)
Add some more cancellability to autosuggestions
Diffstat (limited to 'reader.cpp')
-rw-r--r--reader.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/reader.cpp b/reader.cpp
index ee3daaaa..85b82137 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -1298,7 +1298,7 @@ struct autosuggestion_context_t
return 0;
}
- while (searcher.go_backwards())
+ while (! reader_thread_job_is_stale() && searcher.go_backwards())
{
history_item_t item = searcher.current_item();
@@ -1312,9 +1312,12 @@ struct autosuggestion_context_t
this->autosuggestion = searcher.current_string();
return 1;
}
-
}
+ /* Maybe cancel here */
+ if (reader_thread_job_is_stale())
+ return 0;
+
/* Try handling a special command like cd */
wcstring special_suggestion;
if (autosuggest_suggest_special(search_string, working_directory, special_suggestion))
@@ -1322,6 +1325,10 @@ struct autosuggestion_context_t
this->autosuggestion = special_suggestion;
return 1;
}
+
+ /* Maybe cancel here */
+ if (reader_thread_job_is_stale())
+ return 0;
// Here we do something a little funny
// If the line ends with a space, and the cursor is not at the end,