aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-03-05 20:54:16 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-03-05 20:54:16 -0800
commit4d19bb17a9161fc085e7b308d1ac30ec74186c33 (patch)
treecac5e5e7514ae08c66a43518b531fb86a421d276 /reader.cpp
parentb2012467b327db8d518f2b01eed3d529609f7349 (diff)
Break out COMPLETE_NO_CASE and COMPLETE_REPLACES_TOKEN into separate flags, in preparation for upcoming fuzzy completion work
Diffstat (limited to 'reader.cpp')
-rw-r--r--reader.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/reader.cpp b/reader.cpp
index 2c7d5706..f10e3ad0 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -979,7 +979,7 @@ wcstring completion_apply_to_command_line(const wcstring &val_str, complete_flag
{
const wchar_t *val = val_str.c_str();
bool add_space = !(flags & COMPLETE_NO_SPACE);
- bool do_replace = !!(flags & COMPLETE_NO_CASE);
+ bool do_replace = !!(flags & COMPLETE_REPLACES_TOKEN);
bool do_escape = !(flags & COMPLETE_DONT_ESCAPE);
const size_t cursor_pos = *inout_cursor_pos;
@@ -1134,7 +1134,6 @@ static void run_pager(const wcstring &prefix, int is_quoted, const std::vector<c
return;
wchar_t *escaped_separator;
- int has_case_sensitive=0;
if (prefix.empty())
{
@@ -1155,10 +1154,15 @@ static void run_pager(const wcstring &prefix, int is_quoted, const std::vector<c
escaped_separator = escape(COMPLETE_SEP_STR, 1);
+ bool has_case_sensitive = false;
for (size_t i=0; i< comp.size(); i++)
{
const completion_t &el = comp.at(i);
- has_case_sensitive |= !(el.flags & COMPLETE_NO_CASE);
+ if (! (el.flags & COMPLETE_CASE_INSENSITIVE))
+ {
+ has_case_sensitive = true;
+ break;
+ }
}
for (size_t i=0; i< comp.size(); i++)
@@ -1170,13 +1174,13 @@ static void run_pager(const wcstring &prefix, int is_quoted, const std::vector<c
wcstring completion_text;
wcstring description_text;
- if (has_case_sensitive && (el.flags & COMPLETE_NO_CASE))
+ if (has_case_sensitive && (el.flags & COMPLETE_CASE_INSENSITIVE))
{
continue;
}
// Note that an empty completion is perfectly sensible here, e.g. tab-completing 'foo' with a file called 'foo' and another called 'foobar'
- if (el.flags & COMPLETE_NO_CASE)
+ if (el.flags & COMPLETE_REPLACES_TOKEN)
{
if (base_len == -1)
{
@@ -1328,7 +1332,7 @@ struct autosuggestion_context_t
/* Try normal completions */
std::vector<completion_t> completions;
- complete(search_string, completions, COMPLETE_AUTOSUGGEST, &this->commands_to_load);
+ complete(search_string, completions, COMPLETION_REQUEST_AUTOSUGGESTION, &this->commands_to_load);
if (! completions.empty())
{
const completion_t &comp = completions.at(0);
@@ -3057,8 +3061,9 @@ const wchar_t *reader_readline()
/* Construct a copy of the string from the beginning of the command substitution up to the end of the token we're completing */
const wcstring buffcpy = wcstring(cmdsub_begin, token_end);
-
- data->complete_func(buffcpy, comp, COMPLETE_DEFAULT, NULL);
+
+ //fprintf(stderr, "Complete (%ls)\n", buffcpy.c_str());
+ data->complete_func(buffcpy, comp, COMPLETION_REQUEST_DEFAULT | COMPLETION_REQUEST_DESCRIPTIONS, NULL);
/* Munge our completions */
sort_and_make_unique(comp);