aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-05 09:34:31 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-05 09:34:54 -0800
commit2dda8634e9ec765f4d41937174214b7f444ebe88 (patch)
treed349f70c478c6604a82d740e09470c36ef743c23 /reader.cpp
parent2f313b799a2607e4ecfb704ea850a85b703d6171 (diff)
Fix to stop autosuggesting on whitespace
Diffstat (limited to 'reader.cpp')
-rw-r--r--reader.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/reader.cpp b/reader.cpp
index ba62b1b7..f48dbeb1 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -1301,7 +1301,11 @@ static int threaded_autosuggest(autosuggestion_context_t *ctx) {
}
static bool can_autosuggest(void) {
- return ! data->suppress_autosuggestion && ! data->command_line.empty() && data->history_search.is_at_end();
+ /* We autosuggest if suppress_autosuggestion is not set, if we're not doing a history search, and our command line contains a non-whitespace character. */
+ const wchar_t *whitespace = L" \t\r\n\v";
+ return ! data->suppress_autosuggestion &&
+ data->history_search.is_at_end() &&
+ data->command_line.find_first_not_of(whitespace) != wcstring::npos;
}
static void autosuggest_completed(autosuggestion_context_t *ctx, int result) {