mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-26 03:35:17 +00:00
Run restyle.sh to enforce style rules.
This commit is contained in:
parent
fe3b439e31
commit
0d3169ef70
30 changed files with 450 additions and 443 deletions
|
@ -428,7 +428,7 @@ static void builtin_bind_list(const wchar_t *bind_mode)
|
||||||
if (input_terminfo_get_name(seq, tname))
|
if (input_terminfo_get_name(seq, tname))
|
||||||
{
|
{
|
||||||
append_format(stdout_buffer, L"bind -k %ls -M %ls -m %ls", tname.c_str(), mode.c_str(), sets_mode.c_str());
|
append_format(stdout_buffer, L"bind -k %ls -M %ls -m %ls", tname.c_str(), mode.c_str(), sets_mode.c_str());
|
||||||
for(int i = 0; i < ecmds.size(); i++)
|
for (int i = 0; i < ecmds.size(); i++)
|
||||||
{
|
{
|
||||||
wcstring ecmd = ecmds.at(i);
|
wcstring ecmd = ecmds.at(i);
|
||||||
append_format(stdout_buffer, L" %ls", escape(ecmd.c_str(), 1));
|
append_format(stdout_buffer, L" %ls", escape(ecmd.c_str(), 1));
|
||||||
|
@ -439,7 +439,7 @@ static void builtin_bind_list(const wchar_t *bind_mode)
|
||||||
{
|
{
|
||||||
const wcstring eseq = escape_string(seq, 1);
|
const wcstring eseq = escape_string(seq, 1);
|
||||||
append_format(stdout_buffer, L"bind -k %ls -M %ls -m %ls", eseq.c_str(), mode.c_str(), sets_mode.c_str());
|
append_format(stdout_buffer, L"bind -k %ls -M %ls -m %ls", eseq.c_str(), mode.c_str(), sets_mode.c_str());
|
||||||
for(int i = 0; i < ecmds.size(); i++)
|
for (int i = 0; i < ecmds.size(); i++)
|
||||||
{
|
{
|
||||||
wcstring ecmd = ecmds.at(i);
|
wcstring ecmd = ecmds.at(i);
|
||||||
append_format(stdout_buffer, L" %ls", escape(ecmd.c_str(), 1));
|
append_format(stdout_buffer, L" %ls", escape(ecmd.c_str(), 1));
|
||||||
|
@ -674,7 +674,7 @@ static int builtin_bind(parser_t &parser, wchar_t **argv)
|
||||||
/*
|
/*
|
||||||
* if mode is given, but not new mode, default to new mode to mode
|
* if mode is given, but not new mode, default to new mode to mode
|
||||||
*/
|
*/
|
||||||
if(bind_mode_given && !sets_bind_mode_given)
|
if (bind_mode_given && !sets_bind_mode_given)
|
||||||
{
|
{
|
||||||
sets_bind_mode = bind_mode;
|
sets_bind_mode = bind_mode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -516,7 +516,7 @@ static int builtin_complete(parser_t &parser, wchar_t **argv)
|
||||||
wcstring faux_cmdline_with_completion = completion_apply_to_command_line(next.completion, next.flags, faux_cmdline, &tmp_cursor, false);
|
wcstring faux_cmdline_with_completion = completion_apply_to_command_line(next.completion, next.flags, faux_cmdline, &tmp_cursor, false);
|
||||||
|
|
||||||
/* completion_apply_to_command_line will append a space unless COMPLETE_NO_SPACE is set. We don't want to set COMPLETE_NO_SPACE because that won't close quotes. What we want is to close the quote, but not append the space. So we just look for the space and clear it. */
|
/* completion_apply_to_command_line will append a space unless COMPLETE_NO_SPACE is set. We don't want to set COMPLETE_NO_SPACE because that won't close quotes. What we want is to close the quote, but not append the space. So we just look for the space and clear it. */
|
||||||
if (! (next.flags & COMPLETE_NO_SPACE) && string_suffixes_string(L" ", faux_cmdline_with_completion))
|
if (!(next.flags & COMPLETE_NO_SPACE) && string_suffixes_string(L" ", faux_cmdline_with_completion))
|
||||||
{
|
{
|
||||||
faux_cmdline_with_completion.resize(faux_cmdline_with_completion.size() - 1);
|
faux_cmdline_with_completion.resize(faux_cmdline_with_completion.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,33 +628,33 @@ static void test_parser()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! (detect_argument_errors(L"foo$$") & PARSER_TEST_ERROR))
|
if (!(detect_argument_errors(L"foo$$") & PARSER_TEST_ERROR))
|
||||||
{
|
{
|
||||||
err(L"Bad variable expansion not reported as error");
|
err(L"Bad variable expansion not reported as error");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (detect_argument_errors(L"foo$@") & PARSER_TEST_ERROR))
|
if (!(detect_argument_errors(L"foo$@") & PARSER_TEST_ERROR))
|
||||||
{
|
{
|
||||||
err(L"Bad variable expansion not reported as error");
|
err(L"Bad variable expansion not reported as error");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Within command substitutions, we should be able to detect everything that parse_util_detect_errors can detect */
|
/* Within command substitutions, we should be able to detect everything that parse_util_detect_errors can detect */
|
||||||
if (! (detect_argument_errors(L"foo(cat | or cat)") & PARSER_TEST_ERROR))
|
if (!(detect_argument_errors(L"foo(cat | or cat)") & PARSER_TEST_ERROR))
|
||||||
{
|
{
|
||||||
err(L"Bad command substitution not reported as error");
|
err(L"Bad command substitution not reported as error");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (detect_argument_errors(L"foo\\xFF9") & PARSER_TEST_ERROR))
|
if (!(detect_argument_errors(L"foo\\xFF9") & PARSER_TEST_ERROR))
|
||||||
{
|
{
|
||||||
err(L"Bad escape not reported as error");
|
err(L"Bad escape not reported as error");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (detect_argument_errors(L"foo(echo \\xFF9)") & PARSER_TEST_ERROR))
|
if (!(detect_argument_errors(L"foo(echo \\xFF9)") & PARSER_TEST_ERROR))
|
||||||
{
|
{
|
||||||
err(L"Bad escape in command substitution not reported as error");
|
err(L"Bad escape in command substitution not reported as error");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (detect_argument_errors(L"foo(echo (echo (echo \\xFF9)))") & PARSER_TEST_ERROR))
|
if (!(detect_argument_errors(L"foo(echo (echo (echo \\xFF9)))") & PARSER_TEST_ERROR))
|
||||||
{
|
{
|
||||||
err(L"Bad escape in nested command substitution not reported as error");
|
err(L"Bad escape in nested command substitution not reported as error");
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,7 +362,7 @@ rgb_color_t highlight_get_color(highlight_spec_t highlight, bool is_background)
|
||||||
rgb_color_t result = rgb_color_t::normal();
|
rgb_color_t result = rgb_color_t::normal();
|
||||||
|
|
||||||
/* If sloppy_background is set, then we look at the foreground color even if is_background is set */
|
/* If sloppy_background is set, then we look at the foreground color even if is_background is set */
|
||||||
bool treat_as_background = is_background && ! (highlight & highlight_modifier_sloppy_background);
|
bool treat_as_background = is_background && !(highlight & highlight_modifier_sloppy_background);
|
||||||
|
|
||||||
/* Get the primary variable */
|
/* Get the primary variable */
|
||||||
size_t idx = highlight_get_primary(highlight);
|
size_t idx = highlight_get_primary(highlight);
|
||||||
|
|
10
input.cpp
10
input.cpp
|
@ -312,7 +312,7 @@ void input_set_bind_mode(const wcstring &bm)
|
||||||
*/
|
*/
|
||||||
int input_function_arity(int function)
|
int input_function_arity(int function)
|
||||||
{
|
{
|
||||||
switch(function)
|
switch (function)
|
||||||
{
|
{
|
||||||
case R_FORWARD_JUMP:
|
case R_FORWARD_JUMP:
|
||||||
case R_BACKWARD_JUMP:
|
case R_BACKWARD_JUMP:
|
||||||
|
@ -541,7 +541,7 @@ wchar_t input_function_pop_arg()
|
||||||
void input_function_push_args(int code)
|
void input_function_push_args(int code)
|
||||||
{
|
{
|
||||||
int arity = input_function_arity(code);
|
int arity = input_function_arity(code);
|
||||||
for(int i = 0; i < arity; i++)
|
for (int i = 0; i < arity; i++)
|
||||||
{
|
{
|
||||||
input_function_push_arg(input_common_readch(0));
|
input_function_push_arg(input_common_readch(0));
|
||||||
}
|
}
|
||||||
|
@ -667,7 +667,7 @@ static void input_mapping_execute_matching_or_generic()
|
||||||
{
|
{
|
||||||
generic = &m;
|
generic = &m;
|
||||||
}
|
}
|
||||||
else if(input_mapping_is_match(m))
|
else if (input_mapping_is_match(m))
|
||||||
{
|
{
|
||||||
input_mapping_execute(m);
|
input_mapping_execute(m);
|
||||||
return;
|
return;
|
||||||
|
@ -718,13 +718,13 @@ wint_t input_readch()
|
||||||
}
|
}
|
||||||
case R_AND:
|
case R_AND:
|
||||||
{
|
{
|
||||||
if(input_function_status)
|
if (input_function_status)
|
||||||
{
|
{
|
||||||
return input_readch();
|
return input_readch();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while((c = input_common_readch(0)) && c >= R_MIN && c <= R_MAX);
|
while ((c = input_common_readch(0)) && c >= R_MIN && c <= R_MAX);
|
||||||
input_unreadch(c);
|
input_unreadch(c);
|
||||||
return input_readch();
|
return input_readch();
|
||||||
}
|
}
|
||||||
|
|
8
pager.h
8
pager.h
|
@ -11,7 +11,7 @@
|
||||||
/* Represents rendering from the pager */
|
/* Represents rendering from the pager */
|
||||||
class page_rendering_t
|
class page_rendering_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int term_width;
|
int term_width;
|
||||||
int term_height;
|
int term_height;
|
||||||
size_t rows;
|
size_t rows;
|
||||||
|
@ -58,7 +58,7 @@ class pager_t
|
||||||
size_t visual_selected_completion_index(size_t rows, size_t cols) const;
|
size_t visual_selected_completion_index(size_t rows, size_t cols) const;
|
||||||
|
|
||||||
/** Data structure describing one or a group of related completions */
|
/** Data structure describing one or a group of related completions */
|
||||||
public:
|
public:
|
||||||
struct comp_t
|
struct comp_t
|
||||||
{
|
{
|
||||||
/** The list of all completin strings this entry applies to */
|
/** The list of all completin strings this entry applies to */
|
||||||
|
@ -87,7 +87,7 @@ class pager_t
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::vector<comp_t> comp_info_list_t;
|
typedef std::vector<comp_t> comp_info_list_t;
|
||||||
|
|
||||||
/* The filtered list of completion infos */
|
/* The filtered list of completion infos */
|
||||||
|
@ -111,7 +111,7 @@ class pager_t
|
||||||
line_t completion_print_item(const wcstring &prefix, const comp_t *c, size_t row, size_t column, int width, bool secondary, bool selected, page_rendering_t *rendering) const;
|
line_t completion_print_item(const wcstring &prefix, const comp_t *c, size_t row, size_t column, int width, bool secondary, bool selected, page_rendering_t *rendering) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/* The text of the search field */
|
/* The text of the search field */
|
||||||
editable_line_t search_field_line;
|
editable_line_t search_field_line;
|
||||||
|
|
|
@ -116,7 +116,10 @@ public:
|
||||||
parse_execution_context_t(const parse_node_tree_t &t, const wcstring &s, parser_t *p, int initial_eval_level);
|
parse_execution_context_t(const parse_node_tree_t &t, const wcstring &s, parser_t *p, int initial_eval_level);
|
||||||
|
|
||||||
/* Returns the current eval level */
|
/* Returns the current eval level */
|
||||||
int current_eval_level() const { return eval_level; }
|
int current_eval_level() const
|
||||||
|
{
|
||||||
|
return eval_level;
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns the current line number, indexed from 1. Not const since it touches cached_lineno_offset */
|
/* Returns the current line number, indexed from 1. Not const since it touches cached_lineno_offset */
|
||||||
int get_current_line_number();
|
int get_current_line_number();
|
||||||
|
@ -125,7 +128,10 @@ public:
|
||||||
int get_current_source_offset() const;
|
int get_current_source_offset() const;
|
||||||
|
|
||||||
/* Returns the source string */
|
/* Returns the source string */
|
||||||
const wcstring &get_source() const { return src; }
|
const wcstring &get_source() const
|
||||||
|
{
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
|
||||||
/* Start executing at the given node offset. Returns 0 if there was no error, 1 if there was an error */
|
/* Start executing at the given node offset. Returns 0 if there was no error, 1 if there was an error */
|
||||||
parse_execution_result_t eval_node_at_offset(node_offset_t offset, const block_t *associated_block, const io_chain_t &io);
|
parse_execution_result_t eval_node_at_offset(node_offset_t offset, const block_t *associated_block, const io_chain_t &io);
|
||||||
|
|
|
@ -1502,7 +1502,8 @@ bool parse_node_tree_t::job_should_be_backgrounded(const parse_node_t &job) cons
|
||||||
assert(job.production_idx == 0);
|
assert(job.production_idx == 0);
|
||||||
bool result = false;
|
bool result = false;
|
||||||
const parse_node_t *opt_background = get_child(job, 2, symbol_optional_background);
|
const parse_node_t *opt_background = get_child(job, 2, symbol_optional_background);
|
||||||
if (opt_background != NULL) {
|
if (opt_background != NULL)
|
||||||
|
{
|
||||||
assert(opt_background->production_idx <= 1);
|
assert(opt_background->production_idx <= 1);
|
||||||
result = (opt_background->production_idx == 1);
|
result = (opt_background->production_idx == 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,7 +487,7 @@ static void update_buff_pos(editable_line_t *el, size_t buff_pos)
|
||||||
el->position = buff_pos;
|
el->position = buff_pos;
|
||||||
if (el == &data->command_line && data->sel_active)
|
if (el == &data->command_line && data->sel_active)
|
||||||
{
|
{
|
||||||
if(data->sel_begin_pos <= buff_pos)
|
if (data->sel_begin_pos <= buff_pos)
|
||||||
{
|
{
|
||||||
data->sel_start_pos = data->sel_begin_pos;
|
data->sel_start_pos = data->sel_begin_pos;
|
||||||
data->sel_stop_pos = buff_pos;
|
data->sel_stop_pos = buff_pos;
|
||||||
|
@ -602,7 +602,7 @@ static void reader_repaint()
|
||||||
if (data->sel_active)
|
if (data->sel_active)
|
||||||
{
|
{
|
||||||
highlight_spec_t selection_color = highlight_make_background(highlight_spec_selection);
|
highlight_spec_t selection_color = highlight_make_background(highlight_spec_selection);
|
||||||
for(size_t i = data->sel_start_pos; i <= std::min(len - 1, data->sel_stop_pos); i++)
|
for (size_t i = data->sel_start_pos; i <= std::min(len - 1, data->sel_stop_pos); i++)
|
||||||
{
|
{
|
||||||
colors[i] = selection_color;
|
colors[i] = selection_color;
|
||||||
}
|
}
|
||||||
|
@ -725,7 +725,7 @@ void reader_data_t::command_line_changed(const editable_line_t *el)
|
||||||
|
|
||||||
/* Update the gen count */
|
/* Update the gen count */
|
||||||
s_generation_count++;
|
s_generation_count++;
|
||||||
}
|
}
|
||||||
else if (el == &this->pager.search_field_line)
|
else if (el == &this->pager.search_field_line)
|
||||||
{
|
{
|
||||||
this->pager.refilter_completions();
|
this->pager.refilter_completions();
|
||||||
|
|
2
reader.h
2
reader.h
|
@ -25,7 +25,7 @@ class history_t;
|
||||||
/* Helper class for storing a command line */
|
/* Helper class for storing a command line */
|
||||||
class editable_line_t
|
class editable_line_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** The command line */
|
/** The command line */
|
||||||
wcstring text;
|
wcstring text;
|
||||||
|
|
Loading…
Reference in a new issue