diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-03-05 09:34:31 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-03-05 09:34:54 -0800 |
commit | 2dda8634e9ec765f4d41937174214b7f444ebe88 (patch) | |
tree | d349f70c478c6604a82d740e09470c36ef743c23 /reader.cpp | |
parent | 2f313b799a2607e4ecfb704ea850a85b703d6171 (diff) |
Fix to stop autosuggesting on whitespace
Diffstat (limited to 'reader.cpp')
-rw-r--r-- | reader.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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) { |