aboutsummaryrefslogtreecommitdiffhomepage
path: root/expand.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-05-05 02:33:17 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-05-05 02:33:17 -0700
commit2da81b0ae789c91c196f0ab6f154bf462bafec2d (patch)
tree4155ad8990697991e10caf0e972737c5eaac3de4 /expand.cpp
parentd4c881791fb160b4b2cdc076313da00f29577e24 (diff)
Formatting and style updates
Diffstat (limited to 'expand.cpp')
-rw-r--r--expand.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/expand.cpp b/expand.cpp
index 8ff6de26..74e50102 100644
--- a/expand.cpp
+++ b/expand.cpp
@@ -1490,7 +1490,7 @@ static void expand_home_directory(wcstring &input)
{
size_t tail_idx;
wcstring username = get_home_directory_name(input, &tail_idx);
-
+
bool tilde_error = false;
wcstring home;
if (username.empty())
@@ -1539,7 +1539,7 @@ static void unexpand_tildes(const wcstring &input, std::vector<completion_t> *co
// If it does not, there's nothing to do
if (input.empty() || input.at(0) != L'~')
return;
-
+
// We only operate on completions that replace their contents
// If we don't have any, we're done.
// In particular, empty vectors are common.
@@ -1554,15 +1554,15 @@ static void unexpand_tildes(const wcstring &input, std::vector<completion_t> *co
}
if (! has_candidate_completion)
return;
-
+
size_t tail_idx;
wcstring username_with_tilde = L"~";
username_with_tilde.append(get_home_directory_name(input, &tail_idx));
-
+
// Expand username_with_tilde
wcstring home = username_with_tilde;
expand_tilde(home);
-
+
// Now for each completion that starts with home, replace it with the username_with_tilde
for (size_t i=0; i < completions->size(); i++)
{
@@ -1570,7 +1570,7 @@ static void unexpand_tildes(const wcstring &input, std::vector<completion_t> *co
if ((comp.flags & COMPLETE_REPLACES_TOKEN) && string_prefixes_string(home, comp.completion))
{
comp.completion.replace(0, home.size(), username_with_tilde);
-
+
// And mark that our tilde is literal, so it doesn't try to escape it
comp.flags |= COMPLETE_DONT_ESCAPE_TILDES;
}
@@ -1607,9 +1607,9 @@ static void remove_internal_separator(wcstring &str, bool conv)
int expand_string(const wcstring &input, std::vector<completion_t> &output, expand_flags_t flags)
-{
+{
parser_t parser(PARSER_TYPE_ERRORS_ONLY, true /* show errors */);
-
+
size_t i;
int res = EXPAND_OK;
@@ -1618,7 +1618,7 @@ int expand_string(const wcstring &input, std::vector<completion_t> &output, expa
output.push_back(completion_t(input));
return EXPAND_OK;
}
-
+
std::vector<completion_t> clist1, clist2;
std::vector<completion_t> *in = &clist1, *out = &clist2;
@@ -1642,7 +1642,7 @@ int expand_string(const wcstring &input, std::vector<completion_t> &output, expa
if (! cmdsubst_ok)
return EXPAND_ERROR;
}
-
+
for (i=0; i < in->size(); i++)
{
/*
@@ -1785,19 +1785,19 @@ int expand_string(const wcstring &input, std::vector<completion_t> &output, expa
}
else
{
- if (! (flags & ACCEPT_INCOMPLETE))
+ if (!(flags & ACCEPT_INCOMPLETE))
{
out->push_back(completion_t(next_str));
}
}
}
-
+
// Hack to un-expand tildes (see #647)
- if (! (flags & EXPAND_SKIP_HOME_DIRECTORIES))
+ if (!(flags & EXPAND_SKIP_HOME_DIRECTORIES))
{
unexpand_tildes(input, out);
}
-
+
// Return our output
output.insert(output.end(), out->begin(), out->end());