mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 10:01:14 -03:00
clang-format .cpp and .h files
This commit is contained in:
@@ -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;
|
if (retval != STATUS_CMD_OK) return retval;
|
||||||
} else if (opt == ':') {
|
} else if (opt == ':') {
|
||||||
streams.err.append(L"string "); // clone of string_error
|
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;
|
return STATUS_INVALID_ARGS;
|
||||||
} else if (opt == '?') {
|
} else if (opt == '?') {
|
||||||
string_unknown_option(parser, streams, cmd, argv[w.woptind - 1]);
|
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,
|
int rc = report_match(arg, pcre2_match(regex.code, PCRE2_SPTR(arg.c_str()), arglen, 0, 0,
|
||||||
regex.match, nullptr));
|
regex.match, nullptr));
|
||||||
|
|
||||||
if (rc < 0 /* pcre2 error */) return false;
|
if (rc < 0 /* pcre2 error */)
|
||||||
else if (rc == 0 /* no match */) return true;
|
return false;
|
||||||
else total_matched++;
|
else if (rc == 0 /* no match */)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
total_matched++;
|
||||||
|
|
||||||
if (opts.invert_match) return true;
|
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,
|
rc = report_match(arg, pcre2_match(regex.code, PCRE2_SPTR(arg.c_str()), arglen, offset,
|
||||||
options, regex.match, nullptr));
|
options, regex.match, nullptr));
|
||||||
|
|
||||||
if (rc < 0 /* pcre2 error */) return false;
|
if (rc < 0 /* pcre2 error */)
|
||||||
|
return false;
|
||||||
else if (rc == 0 /* no matches */) {
|
else if (rc == 0 /* no matches */) {
|
||||||
if (options == 0 /* all matches found now */) break;
|
if (options == 0 /* all matches found now */) break;
|
||||||
ovector[1] = offset + 1;
|
ovector[1] = offset + 1;
|
||||||
|
|||||||
@@ -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.
|
// arguments, and penalize files that end in tilde - they're frequently autosave files from e.g.
|
||||||
// emacs.
|
// emacs.
|
||||||
if (flags & completion_request_t::autosuggestion) {
|
if (flags & completion_request_t::autosuggestion) {
|
||||||
stable_sort(comps->begin(), comps->end(),
|
stable_sort(comps->begin(), comps->end(), [](const completion_t &a, const completion_t &b) {
|
||||||
[](const completion_t &a, const completion_t &b) {
|
return compare_completions_by_duplicate_arguments(a, b) ||
|
||||||
return compare_completions_by_duplicate_arguments(a, b) ||
|
compare_completions_by_tilde(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.
|
// 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;
|
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.
|
// 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(),
|
all_completions.insert(all_completions.begin(), completion_set->begin(), completion_set->end());
|
||||||
completion_set->end());
|
|
||||||
sort(all_completions.begin(), all_completions.end(), compare_completions_by_order);
|
sort(all_completions.begin(), all_completions.end(), compare_completions_by_order);
|
||||||
|
|
||||||
for (const completion_entry_t &e : all_completions) {
|
for (const completion_entry_t &e : all_completions) {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ char_event_t input_event_queue_t::readb() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get our uvar notifier.
|
// Get our uvar notifier.
|
||||||
universal_notifier_t ¬ifier = universal_notifier_t::default_notifier();
|
universal_notifier_t& notifier = universal_notifier_t::default_notifier();
|
||||||
|
|
||||||
// Get the notification fd (possibly none).
|
// Get the notification fd (possibly none).
|
||||||
int notifier_fd = notifier.notification_fd();
|
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
|
// Update the wait_on_escape_ms value in response to the fish_escape_delay_ms user variable being
|
||||||
// set.
|
// 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");
|
auto escape_time_ms = vars.get(L"fish_escape_delay_ms");
|
||||||
if (escape_time_ms.missing_or_empty()) {
|
if (escape_time_ms.missing_or_empty()) {
|
||||||
wait_on_escape_ms = WAIT_ON_ESCAPE_DEFAULT;
|
wait_on_escape_ms = WAIT_ON_ESCAPE_DEFAULT;
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ void input_common_init(interrupt_func_t func);
|
|||||||
|
|
||||||
/// Adjust the escape timeout.
|
/// Adjust the escape timeout.
|
||||||
class environment_t;
|
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.
|
/// A class which knows how to produce a stream of input events.
|
||||||
class input_event_queue_t {
|
class input_event_queue_t {
|
||||||
|
|||||||
@@ -1774,7 +1774,8 @@ static void reader_interactive_init(parser_t &parser) {
|
|||||||
if (shell_pgid == 0 || session_interactivity() == session_interactivity_t::explicit_) {
|
if (shell_pgid == 0 || session_interactivity() == session_interactivity_t::explicit_) {
|
||||||
shell_pgid = getpid();
|
shell_pgid = getpid();
|
||||||
if (setpgid(shell_pgid, shell_pgid) < 0) {
|
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.
|
// This should be harmless, so we ignore it.
|
||||||
if (errno != EPERM) {
|
if (errno != EPERM) {
|
||||||
|
|||||||
@@ -1178,8 +1178,8 @@ void s_reset(screen_t *s, screen_reset_mode_t mode) {
|
|||||||
abandon_line_string.append(get_omitted_newline_str());
|
abandon_line_string.append(get_omitted_newline_str());
|
||||||
|
|
||||||
if (cur_term && exit_attribute_mode) {
|
if (cur_term && exit_attribute_mode) {
|
||||||
abandon_line_string.append(
|
abandon_line_string.append(str2wcstring(
|
||||||
str2wcstring(tparm((char *)exit_attribute_mode))); // normal text ANSI escape sequence
|
tparm((char *)exit_attribute_mode))); // normal text ANSI escape sequence
|
||||||
}
|
}
|
||||||
|
|
||||||
int newline_glitch_width = term_has_xn ? 0 : 1;
|
int newline_glitch_width = term_has_xn ? 0 : 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user