mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 12:41:08 +08:00
Restyle codebase
And again clang-format does something I don't like: - if (found != end && std::strncmp(found->name, name, len) == 0 && found->name[len] == 0) return found; + if (found != end && std::strncmp(found->name, name, len) == 0 && found->name[len] == 0) + return found; I *know* this is a bit of a long line. I would still quite like having no brace-less multi-line if *ever*. Either put the body on the same line, or add braces. Blergh
This commit is contained in:
parent
aa895645dd
commit
ab5d7f80d0
|
@ -31,16 +31,16 @@ def issue_role(name, rawtext, text, lineno, inliner, options=None, content=None)
|
|||
if issue_num <= 0:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
msg = inliner.reporter.error(
|
||||
'Invalid issue number: "%s"' % text, line=lineno)
|
||||
msg = inliner.reporter.error('Invalid issue number: "%s"' % text, line=lineno)
|
||||
prb = inliner.problematic(rawtext, rawtext, msg)
|
||||
return [prb], [msg]
|
||||
template=issue_url + "/{n}"
|
||||
template = issue_url + "/{n}"
|
||||
ref = template.format(n=issue_num)
|
||||
issue_text = "#{issue_no}".format(issue_no=issue_num)
|
||||
link = nodes.reference(text=issue_text, refuri=ref, **options)
|
||||
return [link], []
|
||||
|
||||
|
||||
# -- Load our extensions -------------------------------------------------
|
||||
def setup(app):
|
||||
# Our own pygments lexer
|
||||
|
|
|
@ -532,7 +532,11 @@ def append_html_for_ansi_escape(full_val, result, span_open):
|
|||
if match is not None:
|
||||
close_span()
|
||||
# Just use the rgb values directly
|
||||
html_color = "#%02x%02x%02x" % (int(match.group(1)), int(match.group(2)), int(match.group(3)))
|
||||
html_color = "#%02x%02x%02x" % (
|
||||
int(match.group(1)),
|
||||
int(match.group(2)),
|
||||
int(match.group(3)),
|
||||
)
|
||||
result.append('<span style="color: ' + html_color + '">')
|
||||
return True # span now open
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ static int parse_cmd_opts(math_cmd_opts_t &opts, int *optind, //!OCLINT(high nc
|
|||
} else {
|
||||
opts.base = fish_wcstoi(w.woptarg);
|
||||
if (errno || (opts.base != 8 && opts.base != 16)) {
|
||||
streams.err.append_format(_(L"%ls: '%ls' is not a valid base value\n"),
|
||||
cmd, w.woptarg);
|
||||
streams.err.append_format(_(L"%ls: '%ls' is not a valid base value\n"), cmd,
|
||||
w.woptarg);
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
}
|
||||
|
@ -99,8 +99,8 @@ static int parse_cmd_opts(math_cmd_opts_t &opts, int *optind, //!OCLINT(high nc
|
|||
}
|
||||
}
|
||||
if (opts.have_scale && opts.scale != 0 && opts.base != 10) {
|
||||
streams.err.append_format(_(L"%ls: Bases other than 10 can only do scale=0 output currently\n"),
|
||||
cmd, w.woptarg);
|
||||
streams.err.append_format(
|
||||
_(L"%ls: Bases other than 10 can only do scale=0 output currently\n"), cmd, w.woptarg);
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,6 @@ static wcstring format_double(double v, const math_cmd_opts_t &opts) {
|
|||
return format_string(L"%.*f", opts.scale, v);
|
||||
}
|
||||
|
||||
|
||||
wcstring ret = format_string(L"%.*f", opts.scale, v);
|
||||
// If we contain a decimal separator, trim trailing zeros after it, and then the separator
|
||||
// itself if there's nothing after it. Detect a decimal separator as a non-digit.
|
||||
|
|
|
@ -1058,7 +1058,7 @@ class pcre2_matcher_t : public string_matcher_t {
|
|||
// See pcre2demo.c for an explanation of this logic.
|
||||
PCRE2_SIZE arglen = arg.length();
|
||||
auto rc = report_match(arg, pcre2_match(regex.code, PCRE2_SPTR(arg.c_str()), arglen, 0, 0,
|
||||
regex.match, nullptr));
|
||||
regex.match, nullptr));
|
||||
// We only import variables for the *first matching argument*
|
||||
bool had_match = false;
|
||||
if (rc == match_result_t::match && !imported_vars) {
|
||||
|
|
|
@ -244,9 +244,7 @@ bool completion_receiver_t::add(completion_t &&comp) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool completion_receiver_t::add(wcstring &&comp) {
|
||||
return this->add(std::move(comp), wcstring{});
|
||||
}
|
||||
bool completion_receiver_t::add(wcstring &&comp) { return this->add(std::move(comp), wcstring{}); }
|
||||
|
||||
bool completion_receiver_t::add(wcstring &&comp, wcstring desc, complete_flags_t flags,
|
||||
string_fuzzy_match_t match) {
|
||||
|
|
|
@ -127,7 +127,6 @@ static void print_stop_cont() {
|
|||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void show_help();
|
||||
|
|
|
@ -3694,7 +3694,7 @@ maybe_t<wcstring> reader_data_t::readline(int nchars_or_0) {
|
|||
history_search.reset();
|
||||
|
||||
// Get the current terminal modes. These will be restored when the function returns.
|
||||
struct termios old_modes{};
|
||||
struct termios old_modes {};
|
||||
if (tcgetattr(conf.in, &old_modes) == -1 && errno == EIO) redirect_tty_output();
|
||||
|
||||
// Set the new modes.
|
||||
|
|
|
@ -222,7 +222,8 @@ static const te_builtin *find_builtin(const char *name, int len) {
|
|||
return std::strncmp(lhs.name, rhs, len) < 0;
|
||||
});
|
||||
// We need to compare again because we might have gotten the first "larger" element.
|
||||
if (found != end && std::strncmp(found->name, name, len) == 0 && found->name[len] == 0) return found;
|
||||
if (found != end && std::strncmp(found->name, name, len) == 0 && found->name[len] == 0)
|
||||
return found;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ send("\x1A")
|
|||
sleep(0.1)
|
||||
expect_prompt("has stopped")
|
||||
sendline("fg")
|
||||
sleep(0.1) # allow tty to transfer
|
||||
sleep(0.1) # allow tty to transfer
|
||||
send("\x03") # control-c to cancel it
|
||||
|
||||
expect_prompt()
|
||||
|
@ -51,13 +51,13 @@ expect_prompt("jobs: There are no jobs")
|
|||
# Regression test for #2214: foregrounding from a key binding works!
|
||||
sendline(r"bind \cr 'fg >/dev/null 2>/dev/null'")
|
||||
expect_prompt()
|
||||
sendline("$fish_test_helper print_stop_cont");
|
||||
sendline("$fish_test_helper print_stop_cont")
|
||||
sleep(0.2)
|
||||
|
||||
send("\x1A") # ctrl-z
|
||||
send("\x1A") # ctrl-z
|
||||
expect_prompt("SIGTSTP")
|
||||
sleep(0.1)
|
||||
send("\x12") # ctrl-r, placing fth in foreground
|
||||
send("\x12") # ctrl-r, placing fth in foreground
|
||||
expect_str("SIGCONT")
|
||||
|
||||
# Do it again.
|
||||
|
|
|
@ -2,7 +2,12 @@
|
|||
from pexpect_helper import SpawnedProc
|
||||
|
||||
sp = SpawnedProc()
|
||||
send, sendline, expect_prompt, expect_str = sp.send, sp.sendline, sp.expect_prompt, sp.expect_str
|
||||
send, sendline, expect_prompt, expect_str = (
|
||||
sp.send,
|
||||
sp.sendline,
|
||||
sp.expect_prompt,
|
||||
sp.expect_str,
|
||||
)
|
||||
|
||||
expect_prompt()
|
||||
sendline("function echo_wrap ; /bin/echo $argv ; sleep 0.1; end")
|
||||
|
|
Loading…
Reference in New Issue
Block a user