aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-30 11:16:24 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-30 11:16:24 -0700
commitc10b3017d6479bbfeceb3a466b6b2c04aa24d9b8 (patch)
treef40c9c2aeffb46ec33af9cc0c5b3eaa206275edc /reader.cpp
parent0f63e1f988dd90e4c404cb21c3227c2941850550 (diff)
Improve autosuggesting of cd command
Diffstat (limited to 'reader.cpp')
-rw-r--r--reader.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/reader.cpp b/reader.cpp
index bde0bcb1..5bf7cebb 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -1249,6 +1249,7 @@ struct autosuggestion_context_t {
int threaded_autosuggest(void) {
ASSERT_IS_BACKGROUND_THREAD();
+ /* If the main thread has moved on, skip all the work */
if (generation_count != s_generation_count) {
return 0;
}
@@ -1279,6 +1280,13 @@ struct autosuggestion_context_t {
}
}
+ /* Try handling a special command like cd */
+ wcstring special_suggestion;
+ if (autosuggest_suggest_special(search_string, working_directory, special_suggestion)) {
+ this->autosuggestion = special_suggestion;
+ return 1;
+ }
+
/* Try normal completions */
std::vector<completion_t> completions;
complete(search_string, completions, COMPLETE_AUTOSUGGEST, &this->commands_to_load);
@@ -1303,13 +1311,6 @@ struct autosuggestion_context_t {
return 1;
}
- /* Since we didn't find a suggestion from history, try other means */
- wcstring special_suggestion;
- if (autosuggest_suggest_special(search_string, working_directory, special_suggestion)) {
- this->autosuggestion = special_suggestion;
- return 1;
- }
-
return 0;
}
};