Add the input function undo which is bound to `\c_` (control + / on
some terminals). Redoing the most recent chain of undos is supported,
redo is bound to `\e/` for now.
Closes#1367.
This approach should not have the issues discussed in #5897.
Every single modification to the commandline can be undone individually,
except for adjacent single-character inserts, which are coalesced,
so they can be reverted with a single undo. Coalescing is not done for
space characters, so each word can be undone separately.
When moving between history search entries, only the current history
search entry is reachable via the undo history. This allows to go back
to the original search string with a single undo, or by pressing the
escape key.
Similarly, when moving between pager entries, only the most recent
selection in the pager can be undone.
Same issue occurs here, as in #6270 (and fixed in 611a658 for `__fish_describe_command.fish`). Same reason. I've just copied the same workaround and changed the function name to match.
Fixes#6556.
Although present since 2006, fish no longer relies on POSIX-compliant tools to the same degree. This
code causes a platform specific change that makes the tests fail, so remove it.
6902459566 was an attempt to not print
$status twice in the prompt. As a result we print $pipestatus but
not $status, which /usually/ is the same as $pipestatus[-1] --- unless
the builtin "not" is used, which inverts the $status of a job (it does
not alter $pipestatus).
As a result, the default prompt prints unexpected status codes:
~ > not false
~ [1]> not true
~ > not true | true
~ > not false | false
~ [1|1]>
This commit reintroduces printing of $status after $pipestatus, but only
if it is different from $pipestatus[-1].
Additionally, we only print anything at all if the $status is nonzero,
to avoid confusing output on `not false | false`
~ > not false
~ > not true
~ [0] 1> not true | true
~ [0|0] 1> not false | false
~ >
I think this is closer to users' expectations for those cases; they should
not have to think about this implementation detail of the not-statement.
* Replace multiple calls to `tail` and `string` with a single `string
replace` execution
* Dynamically generate list of available benches, bins, and tests for
`--bench`, `--bin`, and `--test` switches
[ci skip]
At the moment the "prepend sudo" functionality always sets the cursor to
the end of the line. This changes it to restore the relative position of
the cursor.
OpenBSD uses [unveil(2)](https://man.openbsd.org/unveil) in chromium and
firefox. This means that things outside of directories like ~/Downloads or /tmp are not visible to the
browsers.
Change webconfig so it uses tempfile.NamedTemporaryFile to create our temp file.
We'd use $__fish_data_dir, but that already had the "/fish" component,
and then we'd add it again later, so we would try to find vendor
functions in places like
/usr/share/fish/fish/vendor_functions.d
which obviously don't exist.
Instead let's add the "/fish" component to the xdg dirs early, which
also saves us from having to repeat it later.
Fixes#6428
See #6508
[ci skip]
It's now good enough to do so.
We don't allow grid-alignment:
```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```
becomes
```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```
It's just more trouble than it is worth.
The one part I'd change:
We align and/or'd parts of an if-condition with the in-block code:
```fish
if true
and false
dosomething
end
```
becomes
```fish
if true
and false
dosomething
end
```
but it's not used terribly much and if we ever fix it we can just
reindent.
They need to be escaped twice, for the local and the remote shell.
Also don't suggest local files as rsync remote paths (-a -> -xa) and
fix completion for remote paths containing multiple consecutive spaces.
Fixes#1872
[ci skip]
$XDG_DATA_DIRS/vendor_{completions,conf,functions}.d
Additionally, CMake variables extra_{completions,conf,functions}dir are
appended, if they are not already contained in $XDG_DATA_DIRS.
If XDG_DATA_DIRS is not defined, we fall back to
$__fish_datadir/vendor_completions.d:${extra_completionsdir}
for completions. Same for conf and functions.
This removes a call to `sed` and allows the user to specify shortening
via the variable.
We still default to disabling shortening because this prompt never
did.
[ci skip]
We just do a cheesy version check and hope it works out.
If this is fixed in 10.15.4, we have to reenable it. If it still isn't
fixed in 10.16, we need to adjust it.
Fixes#6270
Use string split instead of cut - which we'd fork for 2*signal
count times in a loop when tab was first pressed. Noticably faster
If giving a signal num, what works everywhere is -NUM, if giving
a signal name, what works everywhere is -s NAME - don't show -sNUM
or -NAME completions; that only works on GNU and it's redundant
anyhow as we show the signal number in the description field for -s
or the signal name for the -NUM case in the pager.
Sort -sNAME completions by the signal number not alphabetical
Shorten descriptions