aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/highlight.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-06 14:58:51 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-18 17:00:26 -0800
commit5dbf40ca750a1413c5000c6921bff04e17ccd55a (patch)
tree7c0f2c0546ee3c2c648a7881c98f23f90171dbca /src/highlight.cpp
parent2d68b250253eb07f8f796a6fe5f421efc90b70e1 (diff)
Switch autosuggest_suggest_special to returning a completion_t
Diffstat (limited to 'src/highlight.cpp')
-rw-r--r--src/highlight.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/highlight.cpp b/src/highlight.cpp
index d2427d7c..4e5dc3f3 100644
--- a/src/highlight.cpp
+++ b/src/highlight.cpp
@@ -480,13 +480,13 @@ static bool autosuggest_parse_command(const wcstring &buff, wcstring *out_expand
}
/* We have to return an escaped string here */
-bool autosuggest_suggest_special(const wcstring &str, const wcstring &working_directory, wcstring *out_suggestion)
+bool autosuggest_suggest_special(const wcstring &str, const wcstring &working_directory, completion_t *out_suggestion)
{
if (str.empty())
return false;
ASSERT_IS_BACKGROUND_THREAD();
-
+
/* Parse the string */
wcstring parsed_command;
parse_node_t last_arg_node(token_type_invalid);
@@ -502,7 +502,7 @@ bool autosuggest_suggest_special(const wcstring &str, const wcstring &working_di
/* We always return true because we recognized the command. This prevents us from falling back to dumber algorithms; for example we won't suggest a non-directory for the cd command. */
result = true;
- out_suggestion->clear();
+ out_suggestion->completion.clear();
/* Unescape the parameter */
wcstring unescaped_dir;
@@ -520,11 +520,12 @@ bool autosuggest_suggest_special(const wcstring &str, const wcstring &working_di
wcstring escaped_suggested_path = parse_util_escape_string_with_quote(suggested_path, quote);
/* Return it */
- out_suggestion->assign(str);
- out_suggestion->erase(last_arg_node.source_start);
- if (quote != L'\0') out_suggestion->push_back(quote);
- out_suggestion->append(escaped_suggested_path);
- if (quote != L'\0') out_suggestion->push_back(quote);
+ wcstring suggestion = str;
+ suggestion.erase(last_arg_node.source_start);
+ if (quote != L'\0') suggestion.push_back(quote);
+ suggestion.append(escaped_suggested_path);
+ if (quote != L'\0') suggestion.push_back(quote);
+ *out_suggestion = completion_t(suggestion, L"", fuzzy_match_exact, COMPLETE_REPLACES_TOKEN);
}
}
else