aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--builtin.cpp10
-rw-r--r--builtin_commandline.cpp2
-rw-r--r--builtin_printf.cpp2
-rw-r--r--complete.cpp4
-rw-r--r--complete.h2
-rw-r--r--exec.cpp22
-rw-r--r--expand.cpp6
-rw-r--r--fallback.cpp2
-rw-r--r--fish.cpp11
-rw-r--r--fish_tests.cpp6
-rw-r--r--history.cpp8
-rw-r--r--parse_util.cpp10
-rw-r--r--parser.cpp10
-rw-r--r--path.cpp16
-rw-r--r--proc.h5
-rw-r--r--reader.cpp20
-rw-r--r--screen.cpp34
-rw-r--r--screen.h4
-rw-r--r--tokenizer.cpp6
-rw-r--r--wildcard.cpp2
20 files changed, 94 insertions, 88 deletions
diff --git a/builtin.cpp b/builtin.cpp
index 379d5290..c1281a52 100644
--- a/builtin.cpp
+++ b/builtin.cpp
@@ -1617,24 +1617,24 @@ static int builtin_echo(parser_t &parser, wchar_t **argv)
{
case L'n':
print_newline = false;
- break;
+ break;
case L'e':
interpret_special_chars = true;
- break;
+ break;
case L's':
// fish-specific extension,
// which we should try to nix
print_spaces = false;
- break;
+ break;
case L'E':
interpret_special_chars = false;
- break;
+ break;
}
}
}
else
{
- invalid_echo_option:
+invalid_echo_option:
break;
}
argv++;
diff --git a/builtin_commandline.cpp b/builtin_commandline.cpp
index 5564d05b..f6dc2b03 100644
--- a/builtin_commandline.cpp
+++ b/builtin_commandline.cpp
@@ -169,7 +169,7 @@ static void write_part(const wchar_t *begin,
out.push_back(L'\n');
break;
}
-
+
default:
{
break;
diff --git a/builtin_printf.cpp b/builtin_printf.cpp
index efe4a211..b7df7fa8 100644
--- a/builtin_printf.cpp
+++ b/builtin_printf.cpp
@@ -632,7 +632,7 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
}
break;
}
-
+
modify_allowed_format_specifiers(ok, "aAcdeEfFgGiosuxX", true);
for (;; f++, direc_length++)
diff --git a/complete.cpp b/complete.cpp
index 8df02b35..97605527 100644
--- a/complete.cpp
+++ b/complete.cpp
@@ -1627,7 +1627,7 @@ void completer_t::complete_param_expand(const wcstring &sstr, bool do_file)
if (expand_string(comp_str,
this->completions,
- flags ) == EXPAND_ERROR)
+ flags) == EXPAND_ERROR)
{
debug(3, L"Error while expanding string '%ls'", comp_str);
}
@@ -1911,7 +1911,7 @@ void complete(const wcstring &cmd, std::vector<completion_t> &comps, completion_
end_loop=1;
break;
}
-
+
default:
{
break;
diff --git a/complete.h b/complete.h
index 84b84482..72d5a721 100644
--- a/complete.h
+++ b/complete.h
@@ -127,7 +127,7 @@ public:
completion_t(const wcstring &comp, const wcstring &desc = L"", string_fuzzy_match_t match = string_fuzzy_match_t(fuzzy_match_exact), int flags_val = 0);
completion_t(const completion_t &);
completion_t &operator=(const completion_t &);
-
+
/* Compare two completions. No operating overlaoding to make this always explicit (there's potentially multiple ways to compare completions). */
static bool is_alphabetically_less_than(const completion_t &a, const completion_t &b);
static bool is_alphabetically_equal_to(const completion_t &a, const completion_t &b);
diff --git a/exec.cpp b/exec.cpp
index daad09f7..6317b653 100644
--- a/exec.cpp
+++ b/exec.cpp
@@ -551,7 +551,7 @@ static bool can_use_posix_spawn_for_job(const job_t *job, const process_t *proce
return false;
}
}
-
+
/* Now see if we have a redirection involving a file. The only one we allow is /dev/null, which we assume will not fail. */
bool result = true;
if (chain_contains_redirection_to_real_file(job->block_io_chain()) || chain_contains_redirection_to_real_file(process->io_chain()))
@@ -790,11 +790,11 @@ void exec_job(parser_t &parser, job_t *j)
echo alpha | cat < beta.txt
Should cat output alpha or beta? bash and ksh output 'beta', tcsh gets it right and complains about ambiguity, and zsh outputs both (!). No shells appear to output 'alpha', so we match bash here. That would mean putting the pipe first, so that it gets trumped by the file redirection.
-
+
However, eval does this:
-
+
echo "begin; $argv "\n" ;end eval2_inner <&3 3<&-" | source 3<&0
-
+
which depends on the redirection being evaluated before the pipe. So the write end of the pipe comes first, the read pipe of the pipe comes last. See issue #966.
*/
@@ -811,7 +811,7 @@ void exec_job(parser_t &parser, job_t *j)
/* The explicit IO redirections associated with the process */
process_net_io_chain.append(p->io_chain());
-
+
/* Read pipe goes last */
if (p != j->first_process)
{
@@ -820,7 +820,7 @@ void exec_job(parser_t &parser, job_t *j)
pipe_read->pipe_fd[0] = pipe_current_read;
process_net_io_chain.push_back(pipe_read);
}
-
+
/*
This call is used so the global environment variable array
@@ -1241,16 +1241,16 @@ void exec_job(parser_t &parser, job_t *j)
forking is expensive, fish tries to avoid it when
possible.
*/
-
+
bool fork_was_skipped = false;
-
+
const shared_ptr<io_data_t> stdout_io = process_net_io_chain.get_io_for_fd(STDOUT_FILENO);
const shared_ptr<io_data_t> stderr_io = process_net_io_chain.get_io_for_fd(STDERR_FILENO);
-
+
/* If we are outputting to a file, we have to actually do it, even if we have no output, so that we can truncate the file. Does not apply to /dev/null. */
bool must_fork = redirection_is_to_real_file(stdout_io.get()) || redirection_is_to_real_file(stderr_io.get());
if (! must_fork)
- {
+ {
if (p->next == NULL)
{
const bool stdout_is_to_buffer = stdout_io && stdout_io->io_mode == IO_BUFFER;
@@ -1299,7 +1299,7 @@ void exec_job(parser_t &parser, job_t *j)
}
}
}
-
+
if (fork_was_skipped)
{
diff --git a/expand.cpp b/expand.cpp
index 45d29249..5b4a0a7f 100644
--- a/expand.cpp
+++ b/expand.cpp
@@ -1752,15 +1752,15 @@ int expand_string(const wcstring &input, std::vector<completion_t> &output, expa
remove_internal_separator(next_str, (EXPAND_SKIP_WILDCARDS & flags) ? true : false);
const wchar_t *next = next_str.c_str();
-
+
const bool has_wildcard = wildcard_has(next, 1);
-
+
if (has_wildcard && (flags & EXECUTABLES_ONLY))
{
// Don't do wildcard expansion for executables. See #785. So do nothing here.
}
else if (((flags & ACCEPT_INCOMPLETE) && (!(flags & EXPAND_SKIP_WILDCARDS))) ||
- has_wildcard)
+ has_wildcard)
{
const wchar_t *start, *rest;
diff --git a/fallback.cpp b/fallback.cpp
index 6bfe413f..d26907e2 100644
--- a/fallback.cpp
+++ b/fallback.cpp
@@ -1506,7 +1506,7 @@ static int mk_wcswidth(const wchar_t *pwcs, size_t n)
{
if (pwcs[i] == L'\0')
break;
-
+
int w = mk_wcwidth(pwcs[i]);
if (w < 0)
{
diff --git a/fish.cpp b/fish.cpp
index 4f2a3ca6..c61eb582 100644
--- a/fish.cpp
+++ b/fish.cpp
@@ -366,9 +366,12 @@ static int fish_parse_opt(int argc, char **argv, std::vector<std::string> *out_c
is_login |= (strcmp(argv[0], "-fish") == 0);
/* We are an interactive session if we are either forced, or have not been given an explicit command to execute and stdin is a tty. */
- if (force_interactive) {
+ if (force_interactive)
+ {
is_interactive_session = true;
- } else if (is_interactive_session) {
+ }
+ else if (is_interactive_session)
+ {
is_interactive_session = ! has_cmd && (my_optind == argc) && isatty(STDIN_FILENO);
}
@@ -402,7 +405,7 @@ int main(int argc, char **argv)
debug(1, _(L"Can not use the no-execute mode when running an interactive session"));
no_exec = 0;
}
-
+
/* Only save (and therefore restore) the fg process group if we are interactive. See #197, #1002 */
if (is_interactive_session)
{
@@ -509,7 +512,7 @@ int main(int argc, char **argv)
}
proc_fire_event(L"PROCESS_EXIT", EVENT_EXIT, getpid(), res);
-
+
restore_term_mode();
restore_term_foreground_process_group();
history_destroy();
diff --git a/fish_tests.cpp b/fish_tests.cpp
index 8b79ef3a..6b9ec452 100644
--- a/fish_tests.cpp
+++ b/fish_tests.cpp
@@ -532,7 +532,7 @@ static void test_utils()
{
say(L"Testing utils");
const wchar_t *a = L"echo (echo (echo hi";
-
+
const wchar_t *begin = NULL, *end = NULL;
parse_util_cmdsubst_extent(a, 0, &begin, &end);
if (begin != a || end != begin + wcslen(begin)) err(L"parse_util_cmdsubst_extent failed on line %ld", (long)__LINE__);
@@ -542,7 +542,7 @@ static void test_utils()
if (begin != a || end != begin + wcslen(begin)) err(L"parse_util_cmdsubst_extent failed on line %ld", (long)__LINE__);
parse_util_cmdsubst_extent(a, 3, &begin, &end);
if (begin != a || end != begin + wcslen(begin)) err(L"parse_util_cmdsubst_extent failed on line %ld", (long)__LINE__);
-
+
parse_util_cmdsubst_extent(a, 8, &begin, &end);
if (begin != a + wcslen(L"echo (")) err(L"parse_util_cmdsubst_extent failed on line %ld", (long)__LINE__);
@@ -788,7 +788,7 @@ static void test_path()
{
err(L"Bug in canonical PATH code");
}
-
+
if (paths_are_equivalent(L"/foo/bar/baz", L"foo/bar/baz")) err(L"Bug in canonical PATH code on line %ld", (long)__LINE__);
if (! paths_are_equivalent(L"///foo///bar/baz", L"/foo/bar////baz//")) err(L"Bug in canonical PATH code on line %ld", (long)__LINE__);
if (! paths_are_equivalent(L"/foo/bar/baz", L"/foo/bar/baz")) err(L"Bug in canonical PATH code on line %ld", (long)__LINE__);
diff --git a/history.cpp b/history.cpp
index f167f6e4..57689ad4 100644
--- a/history.cpp
+++ b/history.cpp
@@ -629,7 +629,7 @@ void history_t::get_string_representation(wcstring &result, const wcstring &sepa
scoped_lock locker(lock);
bool first = true;
-
+
std::set<wcstring> seen;
/* Append new items. Note that in principle we could use const_reverse_iterator, but we do not because reverse_iterator is not convertible to const_reverse_iterator ( http://github.com/fish-shell/fish-shell/issues/431 ) */
@@ -638,7 +638,7 @@ void history_t::get_string_representation(wcstring &result, const wcstring &sepa
/* Skip duplicates */
if (! seen.insert(iter->str()).second)
continue;
-
+
if (! first)
result.append(separator);
result.append(iter->str());
@@ -651,11 +651,11 @@ void history_t::get_string_representation(wcstring &result, const wcstring &sepa
{
size_t offset = *iter;
const history_item_t item = history_t::decode_item(mmap_start + offset, mmap_length - offset, mmap_type);
-
+
/* Skip duplicates */
if (! seen.insert(item.str()).second)
continue;
-
+
if (! first)
result.append(separator);
result.append(item.str());
diff --git a/parse_util.cpp b/parse_util.cpp
index 5d8a1b1d..3cf407d1 100644
--- a/parse_util.cpp
+++ b/parse_util.cpp
@@ -245,10 +245,10 @@ void parse_util_cmdsubst_extent(const wchar_t *buff, size_t cursor_pos, const wc
const wchar_t * const cursor = buff + cursor_pos;
CHECK(buff,);
-
+
const size_t bufflen = wcslen(buff);
assert(cursor_pos <= bufflen);
-
+
/* ap and bp are the beginning and end of the tightest command substitition found so far */
const wchar_t *ap = buff, *bp = buff + bufflen;
const wchar_t *pos = buff;
@@ -265,7 +265,7 @@ void parse_util_cmdsubst_extent(const wchar_t *buff, size_t cursor_pos, const wc
{
end = const_cast<wchar_t *>(buff) + bufflen;
}
-
+
if (begin < cursor && end >= cursor)
{
/* This command substitution surrounds the cursor, so it's a tighter fit */
@@ -290,7 +290,7 @@ void parse_util_cmdsubst_extent(const wchar_t *buff, size_t cursor_pos, const wc
assert(pos <= buff + bufflen);
}
}
-
+
if (a != NULL) *a = ap;
if (b != NULL) *b = bp;
}
@@ -383,7 +383,7 @@ static void job_or_process_extent(const wchar_t *buff,
break;
}
-
+
default:
{
break;
diff --git a/parser.cpp b/parser.cpp
index 72b46c9f..1228fb2c 100644
--- a/parser.cpp
+++ b/parser.cpp
@@ -2013,7 +2013,7 @@ int parser_t::parse_job(process_t *p,
{
const wchar_t *cmd = args.at(0).completion.c_str();
-
+
/*
We couldn't find the specified command.
@@ -2036,20 +2036,20 @@ int parser_t::parse_job(process_t *p,
if (equals_ptr != NULL)
{
/* Try to figure out if this is a pure variable assignment (foo=bar), or if this appears to be running a command (foo=bar ruby...) */
-
+
const wcstring name_str = wcstring(cmd, equals_ptr - cmd); //variable name, up to the =
const wcstring val_str = wcstring(equals_ptr + 1); //variable value, past the =
-
+
wcstring next_str;
if (tok_peek_next(tok, &next_str) == TOK_STRING && ! next_str.empty())
{
wcstring ellipsis_str = wcstring(1, ellipsis_char);
if (ellipsis_str == L"$")
ellipsis_str = L"...";
-
+
/* Looks like a command */
debug(0,
- _( L"Unknown command '%ls'. Did you mean to run %ls with a modified environment? Try 'env %ls=%ls %ls%ls'. See the help section on the set command by typing 'help set'."),
+ _(L"Unknown command '%ls'. Did you mean to run %ls with a modified environment? Try 'env %ls=%ls %ls%ls'. See the help section on the set command by typing 'help set'."),
cmd,
next_str.c_str(),
name_str.c_str(),
diff --git a/path.cpp b/path.cpp
index 4649e805..a2912f7b 100644
--- a/path.cpp
+++ b/path.cpp
@@ -400,7 +400,7 @@ void path_make_canonical(wcstring &path)
path.at(trailing++) = c;
}
prev_was_slash = is_slash;
- }
+ }
assert(trailing <= len);
if (trailing < len)
path.resize(trailing);
@@ -410,32 +410,32 @@ bool paths_are_equivalent(const wcstring &p1, const wcstring &p2)
{
if (p1 == p2)
return true;
-
+
size_t len1 = p1.size(), len2 = p2.size();
-
+
// Ignore trailing slashes after the first character
while (len1 > 1 && p1.at(len1 - 1) == L'/') len1--;
while (len2 > 1 && p2.at(len2 - 1) == L'/') len2--;
-
+
// Start walking
size_t idx1 = 0, idx2 = 0;
while (idx1 < len1 && idx2 < len2)
{
wchar_t c1 = p1.at(idx1), c2 = p2.at(idx2);
-
+
// If the characters are different, the strings are not equivalent
if (c1 != c2)
break;
-
+
idx1++;
idx2++;
-
+
// If the character was a slash, walk forwards until we hit the end of the string, or a non-slash
// Note the first condition is invariant within the loop
while (c1 == L'/' && idx1 < len1 && p1.at(idx1) == L'/') idx1++;
while (c2 == L'/' && idx2 < len2 && p2.at(idx2) == L'/') idx2++;
}
-
+
// We matched if we consumed all of the characters in both strings
return idx1 == len1 && idx2 == len2;
}
diff --git a/proc.h b/proc.h
index 5e702a91..b1661b80 100644
--- a/proc.h
+++ b/proc.h
@@ -373,7 +373,10 @@ public:
unsigned int flags;
/* Returns the block IO redirections associated with the job. These are things like the IO redirections associated with the begin...end statement. */
- const io_chain_t &block_io_chain() const { return this->block_io; }
+ const io_chain_t &block_io_chain() const
+ {
+ return this->block_io;
+ }
/* Fetch all the IO redirections associated with the job */
io_chain_t all_io_redirections() const;
diff --git a/reader.cpp b/reader.cpp
index 3bd40d01..5b2a5e0a 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -984,9 +984,9 @@ void reader_init()
// PCA disable VDSUSP (typically control-Y), which is a funny job control
// function available only on OS X and BSD systems
// This lets us use control-Y for yank instead
- #ifdef VDSUSP
+#ifdef VDSUSP
shell_modes.c_cc[VDSUSP] = _POSIX_VDISABLE;
- #endif
+#endif
#endif
}
@@ -1723,7 +1723,7 @@ static const completion_t *cycle_competions(const std::vector<completion_t> &com
// note start_idx will be set to -1 initially, so that when it gets incremented we start at 0
const size_t start_idx = *inout_idx;
size_t idx = start_idx;
-
+
const completion_t *result = NULL;
size_t remaining = comp.size();
while (remaining--)
@@ -2340,7 +2340,7 @@ static void handle_token_history(int forward, int reset)
}
}
break;
-
+
default:
{
break;
@@ -3814,34 +3814,34 @@ const wchar_t *reader_readline(void)
}
break;
}
-
+
case R_UPCASE_WORD:
case R_DOWNCASE_WORD:
case R_CAPITALIZE_WORD:
{
// For capitalize_word, whether we've capitalized a character so far
bool capitalized_first = false;
-
+
// We apply the operation from the current location to the end of the word
size_t pos = data->buff_pos;
move_word(MOVE_DIR_RIGHT, false, move_word_style_punctuation, false);
for (; pos < data->buff_pos; pos++)
{
wchar_t chr = data->command_line.at(pos);
-
+
// We always change the case; this decides whether we go uppercase (true) or lowercase (false)
bool make_uppercase;
if (c == R_CAPITALIZE_WORD)
make_uppercase = ! capitalized_first && iswalnum(chr);
else
make_uppercase = (c == R_UPCASE_WORD);
-
+
// Apply the operation and then record what we did
if (make_uppercase)
chr = towupper(chr);
else
chr = towlower(chr);
-
+
data->command_line.at(pos) = chr;
capitalized_first = capitalized_first || make_uppercase;
}
@@ -3850,7 +3850,7 @@ const wchar_t *reader_readline(void)
reader_repaint();
break;
}
-
+
/* Other, if a normal character, we add it to the command */
default:
{
diff --git a/screen.cpp b/screen.cpp
index 5ebe8605..8955059c 100644
--- a/screen.cpp
+++ b/screen.cpp
@@ -137,14 +137,14 @@ static bool allow_soft_wrap(void)
size_t escape_code_length(const wchar_t *code)
{
assert(code != NULL);
-
+
/* The only escape codes we recognize start with \x1b */
if (code[0] != L'\x1b')
return 0;
-
+
size_t resulting_length = 0;
bool found = false;
-
+
if (cur_term != NULL)
{
/*
@@ -158,12 +158,12 @@ size_t escape_code_length(const wchar_t *code)
set_foreground,
set_background,
};
-
+
for (size_t p=0; p < sizeof esc / sizeof *esc && !found; p++)
{
if (!esc[p])
continue;
-
+
for (size_t k=0; k<8; k++)
{
size_t len = try_sequence(tparm(esc[p],k), code);
@@ -176,7 +176,7 @@ size_t escape_code_length(const wchar_t *code)
}
}
}
-
+
if (cur_term != NULL)
{
/*
@@ -206,9 +206,9 @@ size_t escape_code_length(const wchar_t *code)
exit_standout_mode,
enter_secure_mode
};
-
-
-
+
+
+
for (size_t p=0; p < sizeof esc2 / sizeof *esc2 && !found; p++)
{
if (!esc2[p])
@@ -226,7 +226,7 @@ size_t escape_code_length(const wchar_t *code)
}
}
}
-
+
if (!found)
{
if (code[1] == L'k')
@@ -251,7 +251,7 @@ size_t escape_code_length(const wchar_t *code)
}
}
}
-
+
if (! found)
{
/* Generic VT100 one byte sequence: CSI followed by something in the range @ through _ */
@@ -261,7 +261,7 @@ size_t escape_code_length(const wchar_t *code)
found = true;
}
}
-
+
if (! found)
{
/* Generic VT100 CSI-style sequence. <esc>, followed by zero or more ASCII characters NOT in the range [@,_], followed by one character in that range */
@@ -273,11 +273,11 @@ size_t escape_code_length(const wchar_t *code)
{
/* Consume a sequence of ASCII characters not in the range [@, ~] */
wchar_t c = code[cursor];
-
+
/* If we're not in ASCII, just stop */
if (c > 127)
break;
-
+
/* If we're the end character, then consume it and then stop */
if (c >= L'@' && c <= L'~')
{
@@ -290,7 +290,7 @@ size_t escape_code_length(const wchar_t *code)
resulting_length = cursor;
}
}
-
+
if (! found)
{
/* Generic VT100 two byte sequence: <esc> followed by something in the range @ through _ */
@@ -300,7 +300,7 @@ size_t escape_code_length(const wchar_t *code)
found = true;
}
}
-
+
return resulting_length;
}
@@ -1060,7 +1060,7 @@ struct screen_layout_t
wcstring autosuggestion;
/* Whether the prompts get their own line or not */
- bool prompts_get_own_line;
+ bool prompts_get_own_line;
};
/* Given a vector whose indexes are offsets and whose values are the widths of the string if truncated at that offset, return the offset that fits in the given width. Returns width_by_offset.size() - 1 if they all fit. The first value in width_by_offset is assumed to be 0. */
diff --git a/screen.h b/screen.h
index 1d9fde2c..ef74383d 100644
--- a/screen.h
+++ b/screen.h
@@ -140,7 +140,7 @@ public:
/** If we support soft wrapping, we can output to this location without any cursor motion. */
screen_data_t::cursor_t soft_wrap_location;
-
+
/** Whether the last-drawn autosuggestion (if any) is truncated, or hidden entirely */
bool autosuggestion_is_truncated;
@@ -158,7 +158,7 @@ public:
/** If we need to clear, this is how many lines the actual screen had, before we reset it. This is used when resizing the window larger: if the cursor jumps to the line above, we need to remember to clear the subsequent lines. */
size_t actual_lines_before_reset;
-
+
/**
These status buffers are used to check if any output has occurred
other than from fish's main loop, in which case we need to redraw.
diff --git a/tokenizer.cpp b/tokenizer.cpp
index 567b03dc..90c8b703 100644
--- a/tokenizer.cpp
+++ b/tokenizer.cpp
@@ -647,20 +647,20 @@ enum token_type tok_peek_next(tokenizer_t *tok, wcstring *out_next_string)
{
out_next_string->clear();
}
-
+
enum token_type result = TOK_END;
if (tok_has_next(tok))
{
int saved = tok_get_pos(tok);
tok_next(tok);
result = tok_last_type(tok);
-
+
if (out_next_string != NULL)
{
const wchar_t *last = tok_last(tok);
out_next_string->assign(last ? last : L"");
}
-
+
tok_set_pos(tok, saved);
}
return result;
diff --git a/wildcard.cpp b/wildcard.cpp
index 621ece72..2b93561b 100644
--- a/wildcard.cpp
+++ b/wildcard.cpp
@@ -317,7 +317,7 @@ static bool wildcard_complete_internal(const wcstring &orig,
if (wildcard_complete_internal(orig, str + i, wc+1, false, desc, desc_func, out, expand_flags, flags))
{
res = true;
-
+
/* #929: if the recursive call gives us a prefix match, just stop. This is sloppy - what we really want to do is say, once we've seen a match of a particular type, ignore all matches of that type further down the string, such that the wildcard produces the "minimal match." */
bool has_prefix_match = false;
const size_t after_count = out.size();