diff --git a/src/builtin.cpp b/src/builtin.cpp index 9bf331971..44030b9d9 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -82,7 +82,7 @@ bool builtin_data_t::operator<(const builtin_data_t *other) const { /// Counts the number of arguments in the specified null-terminated array int builtin_count_args(const wchar_t *const *argv) { int argc; - for (argc = 1; argv[argc] != NULL;){ + for (argc = 1; argv[argc] != NULL;) { argc++; } @@ -2941,9 +2941,8 @@ static int builtin_history(parser_t &parser, io_streams_t &streams, wchar_t **ar wchar_t *end = 0; max_items = wcstol(w.woptarg, &end, 10); if (!(*w.woptarg != L'\0' && *end == L'\0')) { - streams.err.append_format( - _(L"%ls: max value '%ls' is not a valid number\n"), argv[0], - w.woptarg); + streams.err.append_format(_(L"%ls: max value '%ls' is not a valid number\n"), + argv[0], w.woptarg); return STATUS_BUILTIN_ERROR; } break; diff --git a/src/builtin_set_color.cpp b/src/builtin_set_color.cpp index 35917a63d..229e7f04c 100644 --- a/src/builtin_set_color.cpp +++ b/src/builtin_set_color.cpp @@ -180,7 +180,7 @@ int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **argv) { writembs(tparm(exit_attribute_mode)); } else { if (!write_color(fg, true /* is_fg */)) { - // We need to do *something* or the lack of any output messes up + // We need to do *something* or the lack of any output messes up // when the cartesian product here would make "foo" disappear: // $ echo (set_color foo)bar set_color(rgb_color_t::reset(), rgb_color_t::none()); diff --git a/src/builtin_test.cpp b/src/builtin_test.cpp index 44290b031..b0a131026 100644 --- a/src/builtin_test.cpp +++ b/src/builtin_test.cpp @@ -546,7 +546,7 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err) // Handle errors. // For now we only show the first error. - if (! parser.errors.empty()) { + if (!parser.errors.empty()) { err.append(L"test: "); err.append(parser.errors.at(0)); err.push_back(L'\n'); diff --git a/src/common.h b/src/common.h index 2bdf3e3ae..5a961054a 100644 --- a/src/common.h +++ b/src/common.h @@ -614,7 +614,6 @@ wcstring vformat_string(const wchar_t *format, va_list va_orig); void append_format(wcstring &str, const wchar_t *format, ...); void append_formatv(wcstring &str, const wchar_t *format, va_list ap); - /// This functions returns the end of the quoted substring beginning at \c in. The type of quoting /// character is detemrined by examining \c in. Returns 0 on error. /// diff --git a/src/complete.cpp b/src/complete.cpp index da4160118..5ecf80eb9 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -1572,7 +1572,6 @@ static wrapper_map_t &wrap_map() { return *wrapper_map; } - /// Add a new target that is wrapped by command. Example: __fish_sgrep (command) wraps grep /// (target). bool complete_add_wrapper(const wcstring &command, const wcstring &new_target) { diff --git a/src/fish.cpp b/src/fish.cpp index aee254161..644e62a6f 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -170,7 +170,10 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0) paths.bin = L"" BINDIR; } - debug(2, L"determine_config_directory_paths() results:\npaths.data: %ls\npaths.sysconf: %ls\npaths.doc: %ls\npaths.bin: %ls", paths.data.c_str(), paths.sysconf.c_str(), paths.doc.c_str(), paths.bin.c_str()); + debug(2, + L"determine_config_directory_paths() results:\npaths.data: %ls\npaths.sysconf: " + L"%ls\npaths.doc: %ls\npaths.bin: %ls", + paths.data.c_str(), paths.sysconf.c_str(), paths.doc.c_str(), paths.bin.c_str()); return paths; } diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index bd9bbb910..a8a4b30cd 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -1277,12 +1277,12 @@ static void test_expand() { expand_test(L"/tmp/fish_expand_test/b/yyy", EXPAND_FOR_COMPLETIONS | EXPAND_FUZZY_MATCH, L"/tmp/fish_expand_test/baz/yyy", wnull, L"Wrong fuzzy matching 4"); - + expand_test(L"/tmp/fish_expand_test/aa/x", EXPAND_FOR_COMPLETIONS | EXPAND_FUZZY_MATCH, L"/tmp/fish_expand_test/aaa2/x", wnull, L"Wrong fuzzy matching 5"); - - expand_test(L"/tmp/fish_expand_test/aaa/x", EXPAND_FOR_COMPLETIONS | EXPAND_FUZZY_MATCH, - wnull, L"Wrong fuzzy matching 6 - shouldn't remove valid directory names (#3211)"); + + expand_test(L"/tmp/fish_expand_test/aaa/x", EXPAND_FOR_COMPLETIONS | EXPAND_FUZZY_MATCH, wnull, + L"Wrong fuzzy matching 6 - shouldn't remove valid directory names (#3211)"); if (!expand_test(L"/tmp/fish_expand_test/.*", 0, L"/tmp/fish_expand_test/.foo", 0)) { err(L"Expansion not correctly handling dotfiles"); diff --git a/src/output.cpp b/src/output.cpp index dff1eaad6..7a4cd5524 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -48,7 +48,7 @@ void output_set_writer(int (*writer)(char)) { /// Return the current output writer. int (*output_get_writer())(char) { return out; } -/// Returns true if we think tparm can handle outputting a color index +/// Returns true if we think tparm can handle outputting a color index static bool term_supports_color_natively(unsigned int c) { return max_colors >= (c + 1); } color_support_t output_get_color_support(void) { return color_support; } diff --git a/src/pager.cpp b/src/pager.cpp index edbddb22b..385b48057 100644 --- a/src/pager.cpp +++ b/src/pager.cpp @@ -130,10 +130,12 @@ line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, s { written += print_max(L" ", packed_color, 1, false, &line_data); } - // hack - this just works around the issue - print_max(L"(", highlight_spec_pager_completion | highlight_make_background(bg_color), 1, false, &line_data); + // hack - this just works around the issue + print_max(L"(", highlight_spec_pager_completion | highlight_make_background(bg_color), 1, + false, &line_data); print_max(c->desc, packed_color, desc_width, false, &line_data); - print_max(L")", highlight_spec_pager_completion | highlight_make_background(bg_color), 1, false, &line_data); + print_max(L")", highlight_spec_pager_completion | highlight_make_background(bg_color), 1, + false, &line_data); } else { while (written < width) { written += print_max(L" ", 0, 1, false, &line_data); diff --git a/src/screen.cpp b/src/screen.cpp index e7783d12b..a59c60882 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -206,7 +206,7 @@ size_t escape_code_length(const wchar_t *code) { if (cur_term != NULL) { // Detect these terminfo color escapes with parameter value 0..16, all of which don't move - // the cursor. + // the cursor. char *const esc[] = { set_a_foreground, set_a_background, set_foreground, set_background, }; @@ -240,7 +240,7 @@ size_t escape_code_length(const wchar_t *code) { if (!esc2[p]) continue; // Test both padded and unpadded version, just to be safe. Most versions of tparm don't // actually seem to do anything these days. - + size_t len = maxi(try_sequence(tparm(esc2[p]), code), try_sequence(esc2[p], code)); if (len) { resulting_length = len; @@ -1214,7 +1214,8 @@ void s_reset(screen_t *s, screen_reset_mode_t mode) { abandon_line_string.push_back(omitted_newline_char); if (exit_attribute_mode) { - abandon_line_string.append(str2wcstring(tparm(exit_attribute_mode))); // normal text ANSI escape sequence + abandon_line_string.append( + str2wcstring(tparm(exit_attribute_mode))); // normal text ANSI escape sequence } abandon_line_string.append(screen_width - non_space_width, L' '); } diff --git a/src/wildcard.cpp b/src/wildcard.cpp index 980bea677..5d57ead80 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -836,8 +836,7 @@ void wildcard_expander_t::expand(const wcstring &base_dir, const wchar_t *wc, // Don't do fuzzy matches if the literal segment was valid (#3211) bool allow_fuzzy = (this->flags & (EXPAND_FUZZY_MATCH | EXPAND_NO_FUZZY_DIRECTORIES)) == EXPAND_FUZZY_MATCH; - if (allow_fuzzy && - this->resolved_completions->size() == before && + if (allow_fuzzy && this->resolved_completions->size() == before && waccess(intermediate_dirpath, F_OK) != 0) { assert(this->flags & EXPAND_FOR_COMPLETIONS); DIR *base_dir_fd = open_dir(base_dir);