We use sphinx with rst for our documentation, and github supports rst
here, so it seems weird to have markdown just for these.
It also allows us e.g. to include the CHANGELOG in the docs without
requiring another build dependency.
Currently fish aborts execution mid-pipeline if a file redirection
failed, which can leave the shell in a broken state (job abandoned after
giving control of the terminal to an already-executed job in the
pipeline).
This patch replaces a failed fd with a closed fd and continues execution
if the affected process wasn't the first in the pipeline.
While this is a hack to address the regression behind fish-shell/#7038
introduced in d62576c, it can also be argued that this behavior is
actually more correct... right?
Closes#7038.
* Add an "_" builtin to call into gettext
We already have gettext in C++ (if available), so it seems weird to
fork off a command to start it from script.
This is only for fish's own translations. There's no way to call into
other catalogs, it just translates all arguments separately.
This is faster by a factor of ~1000, which allows us to call
translations much more, especially from scripts.
E.g. making fish_greeting global by default would hurt cost-wise,
given that my fish starts up in 8ms and just calling the current `_`
function takes 2ms, and that would have two calls.
Incidentally, this also makes us rely on a weirdly defined function
less, so it:
Fixes#6804.
* docs: Add `_` docs
Let's see if that filename works out.
* Reword _ docs
This is a function you can either execute once, interactively, or
stick in config.fish, and it will do the right thing.
Some options are included to choose some slightly different behavior,
like setting $PATH directly instead of $fish_user_paths, or moving
already existing components to the front/back instead of ignoring
them, or appending new components instead of prepending them.
The defaults were chosen because they are the most safe, and
especially because they allow it to be idempotent - running it again
and again and again won't change anything, it won't even run the
actual `set` because it skips that if all components are already in.
Fixes#6960.
Variables like $status and $history showed up in all scopes, including
universal, when querying with `set -q` or `set -S`.
This makes it so they all only count as set in global scope, because
we already only allow assignment to electric variables in global scope.
Fixes#7032
This patch fixes an underflow in the jump family of readline commands
when called via `commandline -f` outside of a bind context such as
`commandline -f backward-jump`. To reproduce, run that command at a
prompt and the shell will crash with a buffer underlow.
This happens because the jump commands have non-zero arity, requiring a
character event to be pushed on the function args stack. Pushing the
character event is handled in `function_push_args`, called by
`inputter_t::mapping_execute`, which checks the arity of the function
and enqueues the required number of charcter events. However,
`builtin_commandline` calls `reader_queue_ch`, which in turn calls
`inputter_t::queue_ch`, which immediately enqueues the readline event
without calling `function_push_args`, so the character event is never
pushed on the arg stack.
This patch adds a check in inputter_t::queue_ch which checks if the
character event is a readline event, and if so, calls
`function_push_args`.
fish_git_prompt encloses its output in brackets, however this can be changed by supplying a format string to it, i.e. `fish_git_prompt %s`.
However when using `fish_vcs_prompt` there's no way to pass on the arg to fish_git_prompt, so you need to manually remove it.
fish_hg_prompt doesn't have the same format string support as fish_git_prompt, but I suppose it could be added later if needed.