clang-format .cpp and .h files

This commit is contained in:
ridiculousfish 2020-01-16 15:14:21 -08:00
parent 6705a2efc6
commit 98e714f98f
6 changed files with 22 additions and 18 deletions

View file

@ -459,7 +459,8 @@ static int parse_opts(options_t *opts, int *optind, int n_req_args, int argc, wc
if (retval != STATUS_CMD_OK) return retval;
} else if (opt == ':') {
streams.err.append(L"string "); // clone of string_error
builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1], false /* print_hints */);
builtin_missing_argument(parser, streams, cmd, argv[w.woptind - 1],
false /* print_hints */);
return STATUS_INVALID_ARGS;
} else if (opt == '?') {
string_unknown_option(parser, streams, cmd, argv[w.woptind - 1]);
@ -796,9 +797,12 @@ class pcre2_matcher_t : public string_matcher_t {
int rc = report_match(arg, pcre2_match(regex.code, PCRE2_SPTR(arg.c_str()), arglen, 0, 0,
regex.match, nullptr));
if (rc < 0 /* pcre2 error */) return false;
else if (rc == 0 /* no match */) return true;
else total_matched++;
if (rc < 0 /* pcre2 error */)
return false;
else if (rc == 0 /* no match */)
return true;
else
total_matched++;
if (opts.invert_match) return true;
@ -815,7 +819,8 @@ class pcre2_matcher_t : public string_matcher_t {
rc = report_match(arg, pcre2_match(regex.code, PCRE2_SPTR(arg.c_str()), arglen, offset,
options, regex.match, nullptr));
if (rc < 0 /* pcre2 error */) return false;
if (rc < 0 /* pcre2 error */)
return false;
else if (rc == 0 /* no matches */) {
if (options == 0 /* all matches found now */) break;
ovector[1] = offset + 1;

View file

@ -303,11 +303,10 @@ void completions_sort_and_prioritize(std::vector<completion_t> *comps,
// arguments, and penalize files that end in tilde - they're frequently autosave files from e.g.
// emacs.
if (flags & completion_request_t::autosuggestion) {
stable_sort(comps->begin(), comps->end(),
[](const completion_t &a, const completion_t &b) {
return compare_completions_by_duplicate_arguments(a, b) ||
compare_completions_by_tilde(a, b);
});
stable_sort(comps->begin(), comps->end(), [](const completion_t &a, const completion_t &b) {
return compare_completions_by_duplicate_arguments(a, b) ||
compare_completions_by_tilde(a, b);
});
}
}
@ -1677,8 +1676,7 @@ wcstring complete_print() {
// Get a list of all completions in a vector, then sort it by order.
std::vector<std::reference_wrapper<const completion_entry_t>> all_completions;
// These should be "c"begin/end, but then gcc from ~~the dark ages~~ RHEL 7 would complain.
all_completions.insert(all_completions.begin(), completion_set->begin(),
completion_set->end());
all_completions.insert(all_completions.begin(), completion_set->begin(), completion_set->end());
sort(all_completions.begin(), all_completions.end(), compare_completions_by_order);
for (const completion_entry_t &e : all_completions) {

View file

@ -57,7 +57,7 @@ char_event_t input_event_queue_t::readb() {
}
// Get our uvar notifier.
universal_notifier_t &notifier = universal_notifier_t::default_notifier();
universal_notifier_t& notifier = universal_notifier_t::default_notifier();
// Get the notification fd (possibly none).
int notifier_fd = notifier.notification_fd();
@ -130,7 +130,7 @@ char_event_t input_event_queue_t::readb() {
// Update the wait_on_escape_ms value in response to the fish_escape_delay_ms user variable being
// set.
void update_wait_on_escape_ms(const environment_t &vars) {
void update_wait_on_escape_ms(const environment_t& vars) {
auto escape_time_ms = vars.get(L"fish_escape_delay_ms");
if (escape_time_ms.missing_or_empty()) {
wait_on_escape_ms = WAIT_ON_ESCAPE_DEFAULT;

View file

@ -155,7 +155,7 @@ void input_common_init(interrupt_func_t func);
/// Adjust the escape timeout.
class environment_t;
void update_wait_on_escape_ms(const environment_t &vars);
void update_wait_on_escape_ms(const environment_t& vars);
/// A class which knows how to produce a stream of input events.
class input_event_queue_t {

View file

@ -1774,7 +1774,8 @@ static void reader_interactive_init(parser_t &parser) {
if (shell_pgid == 0 || session_interactivity() == session_interactivity_t::explicit_) {
shell_pgid = getpid();
if (setpgid(shell_pgid, shell_pgid) < 0) {
// If we're session leader setpgid returns EPERM. The other cases where we'd get EPERM don't apply as we passed our own pid.
// If we're session leader setpgid returns EPERM. The other cases where we'd get EPERM
// don't apply as we passed our own pid.
//
// This should be harmless, so we ignore it.
if (errno != EPERM) {

View file

@ -1178,8 +1178,8 @@ void s_reset(screen_t *s, screen_reset_mode_t mode) {
abandon_line_string.append(get_omitted_newline_str());
if (cur_term && exit_attribute_mode) {
abandon_line_string.append(
str2wcstring(tparm((char *)exit_attribute_mode))); // normal text ANSI escape sequence
abandon_line_string.append(str2wcstring(
tparm((char *)exit_attribute_mode))); // normal text ANSI escape sequence
}
int newline_glitch_width = term_has_xn ? 0 : 1;