mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 04:58:57 +00:00
Formatting and style updates
This commit is contained in:
parent
d4c881791f
commit
2da81b0ae7
18 changed files with 115 additions and 79 deletions
|
@ -214,7 +214,7 @@ wcstring builtin_help_get(parser_t &parser, const wchar_t *name)
|
||||||
/* This won't ever work if no_exec is set */
|
/* This won't ever work if no_exec is set */
|
||||||
if (no_exec)
|
if (no_exec)
|
||||||
return wcstring();
|
return wcstring();
|
||||||
|
|
||||||
wcstring_list_t lst;
|
wcstring_list_t lst;
|
||||||
wcstring out;
|
wcstring out;
|
||||||
const wcstring name_esc = escape_string(name, 1);
|
const wcstring name_esc = escape_string(name, 1);
|
||||||
|
|
|
@ -100,23 +100,46 @@ static int hex_to_bin(const wchar_t &c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case L'0': return 0;
|
case L'0':
|
||||||
case L'1': return 1;
|
return 0;
|
||||||
case L'2': return 2;
|
case L'1':
|
||||||
case L'3': return 3;
|
return 1;
|
||||||
case L'4': return 4;
|
case L'2':
|
||||||
case L'5': return 5;
|
return 2;
|
||||||
case L'6': return 6;
|
case L'3':
|
||||||
case L'7': return 7;
|
return 3;
|
||||||
case L'8': return 8;
|
case L'4':
|
||||||
case L'9': return 9;
|
return 4;
|
||||||
case L'a': case L'A': return 10;
|
case L'5':
|
||||||
case L'b': case L'B': return 11;
|
return 5;
|
||||||
case L'c': case L'C': return 12;
|
case L'6':
|
||||||
case L'd': case L'D': return 13;
|
return 6;
|
||||||
case L'e': case L'E': return 14;
|
case L'7':
|
||||||
case L'f': case L'F': return 15;
|
return 7;
|
||||||
default: return -1;
|
case L'8':
|
||||||
|
return 8;
|
||||||
|
case L'9':
|
||||||
|
return 9;
|
||||||
|
case L'a':
|
||||||
|
case L'A':
|
||||||
|
return 10;
|
||||||
|
case L'b':
|
||||||
|
case L'B':
|
||||||
|
return 11;
|
||||||
|
case L'c':
|
||||||
|
case L'C':
|
||||||
|
return 12;
|
||||||
|
case L'd':
|
||||||
|
case L'D':
|
||||||
|
return 13;
|
||||||
|
case L'e':
|
||||||
|
case L'E':
|
||||||
|
return 14;
|
||||||
|
case L'f':
|
||||||
|
case L'F':
|
||||||
|
return 15;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,15 +147,24 @@ static int octal_to_bin(wchar_t c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case L'0': return 0;
|
case L'0':
|
||||||
case L'1': return 1;
|
return 0;
|
||||||
case L'2': return 2;
|
case L'1':
|
||||||
case L'3': return 3;
|
return 1;
|
||||||
case L'4': return 4;
|
case L'2':
|
||||||
case L'5': return 5;
|
return 2;
|
||||||
case L'6': return 6;
|
case L'3':
|
||||||
case L'7': return 7;
|
return 3;
|
||||||
default: return -1;
|
case L'4':
|
||||||
|
return 4;
|
||||||
|
case L'5':
|
||||||
|
return 5;
|
||||||
|
case L'6':
|
||||||
|
return 6;
|
||||||
|
case L'7':
|
||||||
|
return 7;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,9 +390,9 @@ long builtin_printf_state_t::print_esc(const wchar_t *escstart, bool octal_0)
|
||||||
uni_value = uni_value * 16 + hex_to_bin(*p);
|
uni_value = uni_value * 16 + hex_to_bin(*p);
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PCA GNU printf respects the limitations described in ISO N717, about which universal characters "shall not" be specified. I believe this limitation is for the benefit of compilers; I see no reason to impose it in builtin_printf.
|
/* PCA GNU printf respects the limitations described in ISO N717, about which universal characters "shall not" be specified. I believe this limitation is for the benefit of compilers; I see no reason to impose it in builtin_printf.
|
||||||
|
|
||||||
If __STDC_ISO_10646__ is defined, then it means wchar_t can and does hold Unicode code points, so just use that. If not defined, use the %lc printf conversion; this probably won't do anything good if your wide character set is not Unicode, but such platforms are exceedingly rare.
|
If __STDC_ISO_10646__ is defined, then it means wchar_t can and does hold Unicode code points, so just use that. If not defined, use the %lc printf conversion; this probably won't do anything good if your wide character set is not Unicode, but such platforms are exceedingly rare.
|
||||||
*/
|
*/
|
||||||
if (uni_value > 0x10FFFF)
|
if (uni_value > 0x10FFFF)
|
||||||
|
|
|
@ -568,7 +568,7 @@ wcstring wsetlocale(int category, const wchar_t *locale)
|
||||||
|
|
||||||
// U+23CE is the "return" character
|
// U+23CE is the "return" character
|
||||||
omitted_newline_char = unicode ? L'\x23CE' : L'~';
|
omitted_newline_char = unicode ? L'\x23CE' : L'~';
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
return wcstring();
|
return wcstring();
|
||||||
else
|
else
|
||||||
|
|
|
@ -89,7 +89,7 @@ enum
|
||||||
|
|
||||||
/** This completion should be inserted as-is, without escaping. */
|
/** This completion should be inserted as-is, without escaping. */
|
||||||
COMPLETE_DONT_ESCAPE = 1 << 4,
|
COMPLETE_DONT_ESCAPE = 1 << 4,
|
||||||
|
|
||||||
/** If you do escape, don't escape tildes */
|
/** If you do escape, don't escape tildes */
|
||||||
COMPLETE_DONT_ESCAPE_TILDES = 1 << 5
|
COMPLETE_DONT_ESCAPE_TILDES = 1 << 5
|
||||||
};
|
};
|
||||||
|
|
2
event.h
2
event.h
|
@ -49,7 +49,7 @@ enum
|
||||||
*/
|
*/
|
||||||
struct event_t
|
struct event_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Type of event */
|
/** Type of event */
|
||||||
int type;
|
int type;
|
||||||
|
|
5
exec.cpp
5
exec.cpp
|
@ -590,7 +590,8 @@ void exec(parser_t &parser, job_t *j)
|
||||||
CHECK(j,);
|
CHECK(j,);
|
||||||
CHECK_BLOCK();
|
CHECK_BLOCK();
|
||||||
|
|
||||||
if (no_exec) {
|
if (no_exec)
|
||||||
|
{
|
||||||
exec_no_exec(parser, j);
|
exec_no_exec(parser, j);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1312,7 +1313,7 @@ void exec(parser_t &parser, job_t *j)
|
||||||
/* Get argv and envv before we fork */
|
/* Get argv and envv before we fork */
|
||||||
null_terminated_array_t<char> argv_array;
|
null_terminated_array_t<char> argv_array;
|
||||||
convert_wide_array_to_narrow(p->get_argv_array(), &argv_array);
|
convert_wide_array_to_narrow(p->get_argv_array(), &argv_array);
|
||||||
|
|
||||||
/* Ensure that stdin is blocking before we hand it off (see issue #176). It's a little strange that we only do this with stdin and not with stdout or stderr. However in practice, setting or clearing O_NONBLOCK on stdin also sets it for the other two fds, presumably because they refer to the same underlying file (/dev/tty?) */
|
/* Ensure that stdin is blocking before we hand it off (see issue #176). It's a little strange that we only do this with stdin and not with stdout or stderr. However in practice, setting or clearing O_NONBLOCK on stdin also sets it for the other two fds, presumably because they refer to the same underlying file (/dev/tty?) */
|
||||||
make_fd_blocking(STDIN_FILENO);
|
make_fd_blocking(STDIN_FILENO);
|
||||||
|
|
||||||
|
|
28
expand.cpp
28
expand.cpp
|
@ -1490,7 +1490,7 @@ static void expand_home_directory(wcstring &input)
|
||||||
{
|
{
|
||||||
size_t tail_idx;
|
size_t tail_idx;
|
||||||
wcstring username = get_home_directory_name(input, &tail_idx);
|
wcstring username = get_home_directory_name(input, &tail_idx);
|
||||||
|
|
||||||
bool tilde_error = false;
|
bool tilde_error = false;
|
||||||
wcstring home;
|
wcstring home;
|
||||||
if (username.empty())
|
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 it does not, there's nothing to do
|
||||||
if (input.empty() || input.at(0) != L'~')
|
if (input.empty() || input.at(0) != L'~')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// We only operate on completions that replace their contents
|
// We only operate on completions that replace their contents
|
||||||
// If we don't have any, we're done.
|
// If we don't have any, we're done.
|
||||||
// In particular, empty vectors are common.
|
// 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)
|
if (! has_candidate_completion)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size_t tail_idx;
|
size_t tail_idx;
|
||||||
wcstring username_with_tilde = L"~";
|
wcstring username_with_tilde = L"~";
|
||||||
username_with_tilde.append(get_home_directory_name(input, &tail_idx));
|
username_with_tilde.append(get_home_directory_name(input, &tail_idx));
|
||||||
|
|
||||||
// Expand username_with_tilde
|
// Expand username_with_tilde
|
||||||
wcstring home = username_with_tilde;
|
wcstring home = username_with_tilde;
|
||||||
expand_tilde(home);
|
expand_tilde(home);
|
||||||
|
|
||||||
// Now for each completion that starts with home, replace it with the username_with_tilde
|
// Now for each completion that starts with home, replace it with the username_with_tilde
|
||||||
for (size_t i=0; i < completions->size(); i++)
|
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))
|
if ((comp.flags & COMPLETE_REPLACES_TOKEN) && string_prefixes_string(home, comp.completion))
|
||||||
{
|
{
|
||||||
comp.completion.replace(0, home.size(), username_with_tilde);
|
comp.completion.replace(0, home.size(), username_with_tilde);
|
||||||
|
|
||||||
// And mark that our tilde is literal, so it doesn't try to escape it
|
// And mark that our tilde is literal, so it doesn't try to escape it
|
||||||
comp.flags |= COMPLETE_DONT_ESCAPE_TILDES;
|
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)
|
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 */);
|
parser_t parser(PARSER_TYPE_ERRORS_ONLY, true /* show errors */);
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
int res = EXPAND_OK;
|
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));
|
output.push_back(completion_t(input));
|
||||||
return EXPAND_OK;
|
return EXPAND_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<completion_t> clist1, clist2;
|
std::vector<completion_t> clist1, clist2;
|
||||||
std::vector<completion_t> *in = &clist1, *out = &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)
|
if (! cmdsubst_ok)
|
||||||
return EXPAND_ERROR;
|
return EXPAND_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i < in->size(); i++)
|
for (i=0; i < in->size(); i++)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1785,19 +1785,19 @@ int expand_string(const wcstring &input, std::vector<completion_t> &output, expa
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (! (flags & ACCEPT_INCOMPLETE))
|
if (!(flags & ACCEPT_INCOMPLETE))
|
||||||
{
|
{
|
||||||
out->push_back(completion_t(next_str));
|
out->push_back(completion_t(next_str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack to un-expand tildes (see #647)
|
// Hack to un-expand tildes (see #647)
|
||||||
if (! (flags & EXPAND_SKIP_HOME_DIRECTORIES))
|
if (!(flags & EXPAND_SKIP_HOME_DIRECTORIES))
|
||||||
{
|
{
|
||||||
unexpand_tildes(input, out);
|
unexpand_tildes(input, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return our output
|
// Return our output
|
||||||
output.insert(output.end(), out->begin(), out->end());
|
output.insert(output.end(), out->begin(), out->end());
|
||||||
|
|
||||||
|
|
2
fish.cpp
2
fish.cpp
|
@ -462,7 +462,7 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* Stop the exit status of any initialization commands (#635) */
|
/* Stop the exit status of any initialization commands (#635) */
|
||||||
proc_set_last_status(STATUS_BUILTIN_OK);
|
proc_set_last_status(STATUS_BUILTIN_OK);
|
||||||
|
|
||||||
/* Run the commands specified as arguments, if any */
|
/* Run the commands specified as arguments, if any */
|
||||||
if (! cmds.empty())
|
if (! cmds.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1701,7 +1701,7 @@ int main(int argc, char **argv)
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
srand(time(0));
|
srand(time(0));
|
||||||
configure_thread_assertions_for_testing();
|
configure_thread_assertions_for_testing();
|
||||||
|
|
||||||
program_name=L"(ignore)";
|
program_name=L"(ignore)";
|
||||||
|
|
||||||
say(L"Testing low-level functionality");
|
say(L"Testing low-level functionality");
|
||||||
|
@ -1714,7 +1714,7 @@ int main(int argc, char **argv)
|
||||||
builtin_init();
|
builtin_init();
|
||||||
reader_init();
|
reader_init();
|
||||||
env_init();
|
env_init();
|
||||||
|
|
||||||
test_format();
|
test_format();
|
||||||
test_escape();
|
test_escape();
|
||||||
test_convert();
|
test_convert();
|
||||||
|
|
|
@ -1377,9 +1377,12 @@ void highlight_shell(const wcstring &buff, std::vector<int> &color, size_t pos,
|
||||||
for (size_t i=0; i < buff.size(); i++)
|
for (size_t i=0; i < buff.size(); i++)
|
||||||
{
|
{
|
||||||
int ¤t_val = color.at(i);
|
int ¤t_val = color.at(i);
|
||||||
if (current_val >= 0) {
|
if (current_val >= 0)
|
||||||
|
{
|
||||||
last_val = current_val;
|
last_val = current_val;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
current_val = last_val; //note - this writes into the vector
|
current_val = last_val; //note - this writes into the vector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
history.cpp
10
history.cpp
|
@ -70,7 +70,7 @@ class history_output_buffer_t
|
||||||
return s ? strlen(s) : 0;
|
return s ? strlen(s) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/* Add a bit more to HISTORY_OUTPUT_BUFFER_SIZE because we flush once we've exceeded that size */
|
/* Add a bit more to HISTORY_OUTPUT_BUFFER_SIZE because we flush once we've exceeded that size */
|
||||||
history_output_buffer_t() : buffer(HISTORY_OUTPUT_BUFFER_SIZE + 128, '\0'), offset(0)
|
history_output_buffer_t() : buffer(HISTORY_OUTPUT_BUFFER_SIZE + 128, '\0'), offset(0)
|
||||||
|
@ -1070,14 +1070,14 @@ bool history_search_t::go_backwards()
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const bool main_thread = is_main_thread();
|
const bool main_thread = is_main_thread();
|
||||||
|
|
||||||
while (++idx < max_idx)
|
while (++idx < max_idx)
|
||||||
{
|
{
|
||||||
if (main_thread ? reader_interrupted() : reader_thread_job_is_stale())
|
if (main_thread ? reader_interrupted() : reader_thread_job_is_stale())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const history_item_t item = history->item_at_index(idx);
|
const history_item_t item = history->item_at_index(idx);
|
||||||
/* We're done if it's empty or we cancelled */
|
/* We're done if it's empty or we cancelled */
|
||||||
if (item.empty())
|
if (item.empty())
|
||||||
|
@ -1165,7 +1165,7 @@ static void unescape_yaml(std::string &str)
|
||||||
{
|
{
|
||||||
// Operate on a const version of str, to avoid needless COWs that at() does.
|
// Operate on a const version of str, to avoid needless COWs that at() does.
|
||||||
const std::string &const_str = str;
|
const std::string &const_str = str;
|
||||||
|
|
||||||
// Look for a backslash
|
// Look for a backslash
|
||||||
size_t backslash = const_str.find('\\', cursor);
|
size_t backslash = const_str.find('\\', cursor);
|
||||||
if (backslash == std::string::npos || backslash + 1 >= size)
|
if (backslash == std::string::npos || backslash + 1 >= size)
|
||||||
|
@ -1429,7 +1429,7 @@ bool history_t::save_internal_via_appending()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* So far so good. Write all items at or after first_unwritten_new_item_index */
|
/* So far so good. Write all items at or after first_unwritten_new_item_index */
|
||||||
|
|
||||||
bool errored = false;
|
bool errored = false;
|
||||||
history_output_buffer_t buffer;
|
history_output_buffer_t buffer;
|
||||||
while (first_unwritten_new_item_index < new_items.size())
|
while (first_unwritten_new_item_index < new_items.size())
|
||||||
|
|
|
@ -796,8 +796,8 @@ bool input_terminfo_get_sequence(const wchar_t *name, wcstring *out_seq)
|
||||||
{
|
{
|
||||||
errno = err;
|
errno = err;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_seq = format_string(L"%s", res);
|
*out_seq = format_string(L"%s", res);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ static void input_flush_callbacks(void)
|
||||||
/* Nothing to do if nothing to do */
|
/* Nothing to do if nothing to do */
|
||||||
if (callback_queue.empty())
|
if (callback_queue.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* We move the queue into a local variable, so that events queued up during a callback don't get fired until next round. */
|
/* We move the queue into a local variable, so that events queued up during a callback don't get fired until next round. */
|
||||||
callback_queue_t local_queue;
|
callback_queue_t local_queue;
|
||||||
std::swap(local_queue, callback_queue);
|
std::swap(local_queue, callback_queue);
|
||||||
|
|
12
io.h
12
io.h
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#if __cplusplus > 199711L
|
#if __cplusplus > 199711L
|
||||||
// C++11
|
// C++11
|
||||||
#include <memory>
|
#include <memory>
|
||||||
using std::shared_ptr;
|
using std::shared_ptr;
|
||||||
#else
|
#else
|
||||||
// C++03
|
// C++03
|
||||||
#include <tr1/memory>
|
#include <tr1/memory>
|
||||||
using std::tr1::shared_ptr;
|
using std::tr1::shared_ptr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
4
proc.cpp
4
proc.cpp
|
@ -1060,7 +1060,7 @@ void job_continue(job_t *j, bool cont)
|
||||||
{
|
{
|
||||||
/* Put the job into the foreground. Hack: ensure that stdin is marked as blocking first (#176). */
|
/* Put the job into the foreground. Hack: ensure that stdin is marked as blocking first (#176). */
|
||||||
make_fd_blocking(STDIN_FILENO);
|
make_fd_blocking(STDIN_FILENO);
|
||||||
|
|
||||||
signal_block();
|
signal_block();
|
||||||
|
|
||||||
bool ok = terminal_give_to_job(j, cont);
|
bool ok = terminal_give_to_job(j, cont);
|
||||||
|
@ -1202,7 +1202,7 @@ void job_continue(job_t *j, bool cont)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put the shell back in the foreground. */
|
/* Put the shell back in the foreground. */
|
||||||
if (job_get_flag(j, JOB_TERMINAL) && job_get_flag(j, JOB_FOREGROUND))
|
if (job_get_flag(j, JOB_TERMINAL) && job_get_flag(j, JOB_FOREGROUND))
|
||||||
{
|
{
|
||||||
|
|
|
@ -874,7 +874,7 @@ void reader_react_to_color_change()
|
||||||
{
|
{
|
||||||
if (! data)
|
if (! data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (! data->repaint_needed || ! data->screen_reset_needed)
|
if (! data->repaint_needed || ! data->screen_reset_needed)
|
||||||
{
|
{
|
||||||
data->repaint_needed = true;
|
data->repaint_needed = true;
|
||||||
|
@ -1006,7 +1006,7 @@ wcstring completion_apply_to_command_line(const wcstring &val_str, complete_flag
|
||||||
if (do_escape)
|
if (do_escape)
|
||||||
{
|
{
|
||||||
/* Respect COMPLETE_DONT_ESCAPE_TILDES */
|
/* Respect COMPLETE_DONT_ESCAPE_TILDES */
|
||||||
bool no_tilde = !! (flags & COMPLETE_DONT_ESCAPE_TILDES);
|
bool no_tilde = !!(flags & COMPLETE_DONT_ESCAPE_TILDES);
|
||||||
escaped = escape(val, ESCAPE_ALL | ESCAPE_NO_QUOTED | (no_tilde ? ESCAPE_NO_TILDE : 0));
|
escaped = escape(val, ESCAPE_ALL | ESCAPE_NO_QUOTED | (no_tilde ? ESCAPE_NO_TILDE : 0));
|
||||||
sb.append(escaped);
|
sb.append(escaped);
|
||||||
move_cursor = wcslen(escaped);
|
move_cursor = wcslen(escaped);
|
||||||
|
@ -1328,7 +1328,7 @@ struct autosuggestion_context_t
|
||||||
this->autosuggestion = special_suggestion;
|
this->autosuggestion = special_suggestion;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Maybe cancel here */
|
/* Maybe cancel here */
|
||||||
if (reader_thread_job_is_stale())
|
if (reader_thread_job_is_stale())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3087,7 +3087,7 @@ const wchar_t *reader_readline(void)
|
||||||
|
|
||||||
/* Start the cycle at the beginning */
|
/* Start the cycle at the beginning */
|
||||||
completion_cycle_idx = (size_t)(-1);
|
completion_cycle_idx = (size_t)(-1);
|
||||||
|
|
||||||
/* Repaint */
|
/* Repaint */
|
||||||
reader_repaint_if_needed();
|
reader_repaint_if_needed();
|
||||||
}
|
}
|
||||||
|
|
10
wildcard.cpp
10
wildcard.cpp
|
@ -729,7 +729,7 @@ static int wildcard_expand_internal(const wchar_t *wc,
|
||||||
debug(2, L"Got null string on line %d of file %s", __LINE__, __FILE__);
|
debug(2, L"Got null string on line %d of file %s", __LINE__, __FILE__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t base_dir_len = wcslen(base_dir);
|
const size_t base_dir_len = wcslen(base_dir);
|
||||||
|
|
||||||
if (flags & ACCEPT_INCOMPLETE)
|
if (flags & ACCEPT_INCOMPLETE)
|
||||||
|
@ -897,7 +897,7 @@ static int wildcard_expand_internal(const wchar_t *wc,
|
||||||
|
|
||||||
/* new_dir is a scratch area containing the full path to a file/directory we are iterating over */
|
/* new_dir is a scratch area containing the full path to a file/directory we are iterating over */
|
||||||
wcstring new_dir = base_dir;
|
wcstring new_dir = base_dir;
|
||||||
|
|
||||||
wcstring name_str;
|
wcstring name_str;
|
||||||
while (wreaddir(dir, name_str))
|
while (wreaddir(dir, name_str))
|
||||||
{
|
{
|
||||||
|
@ -926,11 +926,11 @@ static int wildcard_expand_internal(const wchar_t *wc,
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
int new_res;
|
int new_res;
|
||||||
|
|
||||||
// new_dir is base_dir + some other path components
|
// new_dir is base_dir + some other path components
|
||||||
// Replace everything after base_dir with the new path component
|
// Replace everything after base_dir with the new path component
|
||||||
new_dir.replace(base_dir_len, wcstring::npos, name_str);
|
new_dir.replace(base_dir_len, wcstring::npos, name_str);
|
||||||
|
|
||||||
int stat_res = wstat(new_dir, &buf);
|
int stat_res = wstat(new_dir, &buf);
|
||||||
|
|
||||||
if (!stat_res)
|
if (!stat_res)
|
||||||
|
@ -942,7 +942,7 @@ static int wildcard_expand_internal(const wchar_t *wc,
|
||||||
if (S_ISDIR(buf.st_mode) && (visited_files.insert(file_id).second || ! is_recursive))
|
if (S_ISDIR(buf.st_mode) && (visited_files.insert(file_id).second || ! is_recursive))
|
||||||
{
|
{
|
||||||
new_dir.push_back(L'/');
|
new_dir.push_back(L'/');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Regular matching
|
Regular matching
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -294,7 +294,7 @@ int make_fd_nonblocking(int fd)
|
||||||
{
|
{
|
||||||
int flags = fcntl(fd, F_GETFL, 0);
|
int flags = fcntl(fd, F_GETFL, 0);
|
||||||
int err = 0;
|
int err = 0;
|
||||||
if (! (flags & O_NONBLOCK))
|
if (!(flags & O_NONBLOCK))
|
||||||
{
|
{
|
||||||
err = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
err = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue