aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-08-02 16:43:37 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-08-08 13:55:49 -0700
commita3f8e27bf8487cf2e74e66cabbd4b1ab6d8294a8 (patch)
tree8378e77979bf57666ff5576f49e812f733c75572
parentb55c13f275519d68ea24ecd08d4bd0f426b94722 (diff)
rename ACCEPT_INCOMPLETE to FOR_COMPLETIONS, which is clearer
-rw-r--r--src/complete.cpp8
-rw-r--r--src/expand.cpp26
-rw-r--r--src/expand.h2
-rw-r--r--src/fish_tests.cpp2
-rw-r--r--src/wildcard.cpp12
-rw-r--r--src/wildcard.h2
6 files changed, 26 insertions, 26 deletions
diff --git a/src/complete.cpp b/src/complete.cpp
index 58799eb2..24e0688b 100644
--- a/src/complete.cpp
+++ b/src/complete.cpp
@@ -1133,7 +1133,7 @@ void completer_t::complete_cmd(const wcstring &str_cmd, bool use_function, bool
if (use_command)
{
- if (expand_string(str_cmd, &this->completions, ACCEPT_INCOMPLETE | EXECUTABLES_ONLY | this->expand_flags(), NULL) != EXPAND_ERROR)
+ if (expand_string(str_cmd, &this->completions, FOR_COMPLETIONS | EXECUTABLES_ONLY | this->expand_flags(), NULL) != EXPAND_ERROR)
{
if (this->wants_descriptions())
{
@@ -1143,7 +1143,7 @@ void completer_t::complete_cmd(const wcstring &str_cmd, bool use_function, bool
}
if (use_implicit_cd)
{
- if (!expand_string(str_cmd, &this->completions, ACCEPT_INCOMPLETE | DIRECTORIES_ONLY | this->expand_flags(), NULL))
+ if (!expand_string(str_cmd, &this->completions, FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(), NULL))
{
// Not valid as implicit cd.
}
@@ -1173,7 +1173,7 @@ void completer_t::complete_cmd(const wcstring &str_cmd, bool use_function, bool
size_t prev_count = this->completions.size();
if (expand_string(nxt_completion,
&this->completions,
- ACCEPT_INCOMPLETE | EXECUTABLES_ONLY | this->expand_flags(), NULL) != EXPAND_ERROR)
+ FOR_COMPLETIONS | EXECUTABLES_ONLY | this->expand_flags(), NULL) != EXPAND_ERROR)
{
/* For all new completions, if COMPLETE_NO_CASE is set, then use only the last path component */
for (size_t i=prev_count; i< this->completions.size(); i++)
@@ -1610,7 +1610,7 @@ bool completer_t::complete_param(const wcstring &scmd_orig, const wcstring &spop
*/
void completer_t::complete_param_expand(const wcstring &str, bool do_file, bool directories_only)
{
- expand_flags_t flags = EXPAND_SKIP_CMDSUBST | ACCEPT_INCOMPLETE | this->expand_flags();
+ expand_flags_t flags = EXPAND_SKIP_CMDSUBST | FOR_COMPLETIONS | this->expand_flags();
if (! do_file)
flags |= EXPAND_SKIP_WILDCARDS;
diff --git a/src/expand.cpp b/src/expand.cpp
index aca6d97a..b5761610 100644
--- a/src/expand.cpp
+++ b/src/expand.cpp
@@ -616,7 +616,7 @@ static int find_job(const struct find_job_data_t *info)
This is a numeric job string, like '%2'
*/
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
job_iterator_t jobs;
while ((j = jobs.next()))
@@ -672,7 +672,7 @@ static int find_job(const struct find_job_data_t *info)
size_t offset;
if (match_pid(j->command(), proc, flags, &offset))
{
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
append_completion(&completions,
j->command_wcstr() + offset + wcslen(proc),
@@ -703,7 +703,7 @@ static int find_job(const struct find_job_data_t *info)
size_t offset;
if (match_pid(p->actual_cmd, proc, flags, &offset))
{
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
append_completion(&completions,
wcstring(p->actual_cmd, offset + wcslen(proc)),
@@ -763,7 +763,7 @@ static void find_process(const wchar_t *proc, expand_flags_t flags, std::vector<
size_t offset;
if (match_pid(process_name, proc, flags, &offset))
{
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
append_completion(out,
process_name.c_str() + offset + wcslen(proc),
@@ -808,7 +808,7 @@ static bool expand_pid(const wcstring &instr_with_sep, expand_flags_t flags, std
/* We know we are a process expansion now */
assert(in[0] == PROCESS_EXPAND);
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
if (wcsncmp(in+1, SELF_STR, wcslen(in+1))==0)
{
@@ -849,7 +849,7 @@ static bool expand_pid(const wcstring &instr_with_sep, expand_flags_t flags, std
if (prev_count == out->size())
{
- if (!(flags & ACCEPT_INCOMPLETE))
+ if (!(flags & FOR_COMPLETIONS))
{
/* We failed to find anything */
append_syntax_error(errors, 1, FAILED_EXPANSION_PROCESS_ERR_MSG, escape(in+1, ESCAPE_NO_QUOTED).c_str());
@@ -1300,7 +1300,7 @@ static int expand_brackets(parser_t &parser, const wcstring &instr, int flags, s
if (bracket_count > 0)
{
- if (!(flags & ACCEPT_INCOMPLETE))
+ if (!(flags & FOR_COMPLETIONS))
{
syntax_error = true;
}
@@ -1682,7 +1682,7 @@ int expand_string(const wcstring &input, std::vector<completion_t> *output, expa
size_t i;
int res = EXPAND_OK;
- if ((!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean(input.c_str()))
+ if ((!(flags & FOR_COMPLETIONS)) && expand_is_clean(input.c_str()))
{
append_completion(output, input);
return EXPAND_OK;
@@ -1761,7 +1761,7 @@ int expand_string(const wcstring &input, std::vector<completion_t> *output, expa
if (!(EXPAND_SKIP_HOME_DIRECTORIES & flags))
expand_home_directory(next);
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
if (! next.empty() && next.at(0) == PROCESS_EXPAND)
{
@@ -1799,7 +1799,7 @@ int expand_string(const wcstring &input, std::vector<completion_t> *output, expa
{
// Don't do wildcard expansion for executables. See #785. So do nothing here.
}
- else if (((flags & ACCEPT_INCOMPLETE) && (!(flags & EXPAND_SKIP_WILDCARDS))) ||
+ else if (((flags & FOR_COMPLETIONS) && (!(flags & EXPAND_SKIP_WILDCARDS))) ||
has_wildcard)
{
wcstring start, rest;
@@ -1817,7 +1817,7 @@ int expand_string(const wcstring &input, std::vector<completion_t> *output, expa
std::vector<completion_t> expanded;
wc_res = wildcard_expand_string(rest, start, flags, &expanded);
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
out->insert(out->end(), expanded.begin(), expanded.end());
}
@@ -1850,7 +1850,7 @@ int expand_string(const wcstring &input, std::vector<completion_t> *output, expa
}
else
{
- if (!(flags & ACCEPT_INCOMPLETE))
+ if (!(flags & FOR_COMPLETIONS))
{
append_completion(out, next);
}
@@ -1874,7 +1874,7 @@ bool expand_one(wcstring &string, expand_flags_t flags, parse_error_list_t *erro
std::vector<completion_t> completions;
bool result = false;
- if ((!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean(string.c_str()))
+ if ((!(flags & FOR_COMPLETIONS)) && expand_is_clean(string.c_str()))
{
return true;
}
diff --git a/src/expand.h b/src/expand.h
index 04cfa743..94f2c98c 100644
--- a/src/expand.h
+++ b/src/expand.h
@@ -41,7 +41,7 @@ enum
prefix of the filename. If accept_incomplete is true, only the
remainder of the string is returned.
*/
- ACCEPT_INCOMPLETE = 1 << 3,
+ FOR_COMPLETIONS = 1 << 3,
/** Only match files that are executable by the current user. Only applicable together with ACCEPT_INCOMPLETE. */
EXECUTABLES_ONLY = 1 << 4,
diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp
index baa6e53a..157ee5ab 100644
--- a/src/fish_tests.cpp
+++ b/src/fish_tests.cpp
@@ -1435,7 +1435,7 @@ static void test_expand()
expand_test(L"a*", EXPAND_SKIP_WILDCARDS, L"a*", 0,
L"Cannot skip wildcard expansion");
- expand_test(L"/bin/l\\0", ACCEPT_INCOMPLETE, 0,
+ expand_test(L"/bin/l\\0", FOR_COMPLETIONS, 0,
L"Failed to handle null escape in expansion");
expand_test(L"foo\\$bar", EXPAND_SKIP_VARIABLES, L"foo$bar", 0,
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index e8e1567c..bc1322dc 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -746,7 +746,7 @@ void wildcard_expander_t::expand_trailing_slash(const wcstring &base_dir)
return;
}
- if (! (flags & ACCEPT_INCOMPLETE))
+ if (! (flags & FOR_COMPLETIONS))
{
/* Trailing slash and not accepting incomplete, e.g. `echo /tmp/`. Insert this file if it exists. */
if (waccess(base_dir, F_OK))
@@ -817,7 +817,7 @@ void wildcard_expander_t::expand_last_segment(const wcstring &base_dir, DIR *bas
wcstring name_str;
while (wreaddir(base_dir_fp, name_str))
{
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
/* Test for matches before stating file, so as to minimize the number of calls to the much slower stat function. The only expand flag we care about is EXPAND_FUZZY_MATCH; we have no complete flags. */
std::vector<completion_t> local_matches;
@@ -1003,7 +1003,7 @@ static int wildcard_expand_internal(const wchar_t *wc,
const size_t base_dir_len = wcslen(base_dir);
const size_t wc_len = wcslen(wc);
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
/*
Avoid excessive number of returned matches for wc ending with a *
@@ -1068,7 +1068,7 @@ static int wildcard_expand_internal(const wchar_t *wc,
The last wildcard segment is empty. Insert everything if
completing, the directory itself otherwise.
*/
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
wcstring next;
while (wreaddir(dir, next))
@@ -1096,7 +1096,7 @@ static int wildcard_expand_internal(const wchar_t *wc,
wcstring name_str;
while (wreaddir(dir, name_str))
{
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
const wcstring long_name = make_path(base_dir, name_str);
@@ -1281,7 +1281,7 @@ static int wildcard_expand(const wchar_t *wc,
wildcard_expander_t expander(flags, out);
expander.expand(base_dir, wc);
- if (flags & ACCEPT_INCOMPLETE)
+ if (flags & FOR_COMPLETIONS)
{
wcstring wc_base;
const wchar_t *wc_base_ptr = wcsrchr(wc, L'/');
diff --git a/src/wildcard.h b/src/wildcard.h
index a22f8338..9325bb4c 100644
--- a/src/wildcard.h
+++ b/src/wildcard.h
@@ -59,7 +59,7 @@ enum
\param wc The wildcard string
\param base_dir The base directory of the filesystem to perform the match against
- \param flags flags for the search. Can be any combination of ACCEPT_INCOMPLETE and EXECUTABLES_ONLY
+ \param flags flags for the search. Can be any combination of FOR_COMPLETIONS and EXECUTABLES_ONLY
\param out The list in which to put the output
\return 1 if matches where found, 0 otherwise. Return -1 on abort (I.e. ^C was pressed).