Add a helper function to check if the user is root. This function can be
useful for the prompts for example. Modify the prompts made root checked
to use the function instead. Add also the support of Administrator like
a root user.
Fixes: #7031
After profiling bottlenecks in job execution, the calls to `tcgetpgrp`
were identified to take a good amount of the execution time. Collecting
metrics on which branches were taken revealed that in all "normal"
cases, there is no benefit to calling `tcgetpgrp` before calling
`tcsetpgrp` as it can instead be called only in the error case to
determine what sort of error handling behavior should be applied.
This makes the best-case scenario of a single syscall much more likely
than in the previous situation.
Profiling revealed string comparison in variable lookups to be a
significant hotspot. This change causes `make test` to complete ~4.5%
faster per `hyperfine`.
This was originally comparing two pointers for equality but after the
refactor to wcstring it ended up comparing a const string pointer to the
_contents_ of the wcstring.
I really kinda hate how insistent clang-format is to have line
breaks *IFF THE LINE IS TOO LONG*.
Like... lemme just add a break if it looks better, will you?
But it is the style at this time, so we shall tie an onion to our
belt.
* completions/git: Show all accepted values with git config
Finally closes#3812.
Acceptable values are generated using `git help --config`
* completions/git: Show config value as description for git config
* completions/git: Handle multiline config values
When completing `git config` only display the first
line of config value as description if it is
multiline, appended with an ellipsis.
* Fix#7113 (cannot call help using msys2), correct a few regexes.
* Use regex instead of glob-style matching
* Match `\.exe$` instead of `cmd\.exe$` for WSL
* Match `\.exe(\s+|$)` instead of `\.exe$` and `cmd\.exe$`
* Fix a few regexes
This allows cygstart to be manually set as a browser, with or without arguments
This makes binding \cz possible.
We already ignore the SIGTSTP signal it sends, so until now it was useless.
(also STOP and START for good measure, but since we disable flow
control in fish anyway these already shouldn't have been sent)
Fixes#7152
`adb` shell by default sends stderr from the command to stdout, so that `adb pull nonexistent<tab>` will show the error message from the `find` command. `>` must be escaped so that redirection is done inside the command executed by `adb shell`.
Profiling shows that parsing color names still took much longer than it
should.
wcscasecmp is so slow that using it directly causes `try_parse_special`
to consume up to 3% of all of fish's cpu time due to extremely
inefficient invariant case lookups for wide characters (tested: Fedora
Server 32 w/ glibc 2.31 with -O2).
- Complete signals with --on-signal
- Complete variables with --on-variable and --inherit-variable
- Complete event handlers with --on-event
- Complete commands with --wraps
- Add `complete` spec for --inherit-variable
These control the disambiguation between ctrl-j and ctrl-m.
This can cause the enter key to send a ctrl-m, which programs might be
unprepared for.
(This is why you need to do `stty sane<ctrl-j>`)
The `reserve` here can, under certain circumstances, reserve more than
strictly needed.
The simple workaround is to just never look at more than we feed in.
(really what we'd *want* is to look at the length of the *color
names*, but those are wchar, so length lookup is crappy NULL-lookup)
This had this weird "pass along the sha, then check" logic to it which
is entirely unnecessary.
This function just says when something is staged, nothing more. Why
that is you can figure out for yourself.
This makes it easier to call this function, and it no longer prints an
empty line if nothing is staged.
This was profiled to be a hotspot during startup. The usage of
wcscasecmp in a loop caused repeated transforms to lowercase, which is
incredibly slow for wide characters.
This makes it possible to expand the signals checked by the type. I can't merge
the sigttin fixes for #7060 yet because they introduce new breakage, but this
will make merging any future fix easier.
This was intended to stop showing the user "unimportant" variables,
but it just didn't complete them entirely, even if the current token
starts with a dunder (or `fish` of all things!).
Because completions sort `_` last, let's just complete these always
and let the user filter them.
This wasn't added to the prompt status order, so it was computed and
then not used for the informative prompt.
We still check later if we should compute it, so this is harmless if
showstashstate is unset.
Fixes#7136.
In #7133, neovim crashing caused "OPOST" to be turned off, which
caused a weird staircase display.
So we just force a set of settings that don't seem useful to change to
avoid breaking the terminal with something like that.
Fixes#7133.
A broken/missing optspec or `--` is a bug in the script using
argparse, an unknown option or invalid argument is a bug in using that script.
So in the former case print a stacktrace, because the person writing
the `argparse` call is at fault, in the latter don't.
Fixes#6703.