19685 Commits

Author SHA1 Message Date
Fabian Boehm
3469fd25ec CI: Use renamed test target
Because CMake no longer allows making a custom "test" target, we
removed it and now need to run "fish_run_tests" instead
2025-02-05 19:22:26 +01:00
Fabian Boehm
378f452eaa Revert token movement bindings
Comments by macOS users have shown that, apparently, on that platform
this isn't wanted.

The functions are there for people to use,
but we need more time to figure out if and how we're going to bind
these by default.
For example, we could change these bindings depending on the OS in future.

This reverts most of commit 6af96a81a8c6ff5e632d4dda7448f5f01d7a5d35.

Fixes #10926
See #11107
2025-02-05 19:06:37 +01:00
Fabian Boehm
04151d758b Remove cmake "test" target
This can no longer be overridden, which means we have a broken "test"
target now. Instead, you need to call "make fish_run_tests".

Blergh.

Fixes #11116

(cherry picked from commit 8d6fdfd9deb78545ecbf2a2eabd90aeb7cbaf78e)
2025-02-03 13:39:22 +01:00
phanium
bf91da5979
Fix twice tokenize editor_cmd
```fish
export VISUAL='nvim --cmd let\ g:flatten_wait=1'
funced -s fish_prompt
```

`editor_cmd[3]` would be `let` rather than `let g:flatten_wait=1`
2025-02-02 16:21:12 -08:00
Fabian Boehm
2f2ea729a7 completions/csvlens: Fix missing option
(cherry picked from commit bba15c6d14583778e458bfc96364ffc2f3057eb0)
2025-01-31 19:34:51 +01:00
Fabian Boehm
db48cd547b Reset read_limit back to default
Regression introduced in 6638c78b30310c9c0b235e989827d9639a7897c4

Reintroduces #9129

It's unclear why the tests didn't fail

(cherry picked from commit 6d8f1aeb27671fc3735fc936919ddfdb167b6b13)
2025-01-31 16:31:55 +01:00
kerty
acadf00718 Fix regression causing variable completions to not have description
Regressed in 17bd7d0 (Switch completion_request_options_t from a list of flags to a struct, 2022-06-07).
2025-01-31 13:41:02 +01:00
Fabian Boehm
93ac5d0eb3 pager: fix selected color regression
To check:

```fish
fish_config theme choose None
set -g fish_pager_color_selected_completion blue
```

Now the selected color will only apply to the parentheses

Missed in 43e2d7b48c21d1377c2bd34b3b2ef9c0016a38e4 (Port pager.cpp)

(cherry picked from commit 6c4d658c15e258e48cce4874cb638c5d23522051)
2025-01-30 16:27:31 +01:00
David Adam
5aec9e3b47 docs/fish: minor style/proofing edits
Some checks failed
make test / macos (push) Has been cancelled
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
Rust checks / clippy (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
(cherry picked from commit be48d73599d01aa246ddfb2c2f03e094dacedf85)
2025-01-29 22:47:06 +08:00
David Adam
d7fb0308a7 docs/language: update target release for feature flags from 3.8 to 4.0
see also 24abbb6de7f044

(cherry picked from commit 1cf71656efbc98ff672cbd1ff3e31956d9adb9d1)
2025-01-29 22:47:05 +08:00
Ilya Grigoriev
fa5de3ece8 language.rst: make description of features more consistent (minor)
The version where a feature became the default is now described inline,
to make it a single source of truth. I could have fixed the other
section where this was described, but this seemed easier.

I also removed a few details that seem no longer relevant.

(cherry picked from commit 064d867873b96989fc5736a394d9264205905f7e)
2025-01-29 22:46:29 +08:00
Johannes Altmanninger
29e69bd113 Fix broken completions for "mount -ouid="
Cherry-picked from b46417c77b (Fix broken completions for "mount
-ouid=", 2024-11-21).
2025-01-29 10:33:20 +01:00
Johannes Altmanninger
4d6544591e Fix regression breaking automatic history saving after adding ephemeral items
Cherry-picked from acf9ba4195 (Fix regression causing missing automatic
history saving after adding ephemeral items, 2025-01-29)
2025-01-29 10:32:24 +01:00
David Adam
bfbee7a7ff CHANGELOG: work on 4.0.0 2025-01-28 23:32:38 +08:00
David Adam
3400844f9a completions/acpi: correct the -c option as cooling
Closes #11068.

(cherry picked from commit 2184aaf9b468c1df77a57778533a3e1368e66ed4)
2025-01-28 21:56:54 +08:00
Ilya Grigoriev
f1bb4e02fe completions/tmux: some windows and panes boolean flag completions
This documents some non-argument options for the window and panes
commands. The choice of what to document is somewhat arbitrary,
this commit is biased towards options that I find confusing or
misleading without documentation (is `-a` "all" or "after"?)
and the command that seem more useful to me.

I also didn't cover the options that would be covered by
#10855 (though this PR can be used independently). I'm not
sure how much difference this made, it might not matter at
all.

(cherry picked from commit f241187c4a47bae2016da78ef2c6b2b7b5345747)
2025-01-28 21:42:24 +08:00
Ilya Grigoriev
9385a25c22 completions/tmux: complete commands inside tmux lscm
Make `tmux lscm <tab>` work.

(cherry picked from commit 77406ddd1112df84725570b6ab1834f16d00c8e1)
2025-01-28 21:42:14 +08:00
Ilya Grigoriev
323bddcce6 completions/tmux: complete all flags when tmux lscm is available
These dynamic completions are exhaustive, but not as well-documented or
as ergonomic as the manual completions. So, any manual completions
should override them.

(cherry picked from commit 183e20cc3a60bbf93f50d9bf35a68dab665208e6)
2025-01-28 21:42:06 +08:00
Ilya Grigoriev
d29d63d930 completions/tmux: complete all subcommands when tmux lscm works
For example, `tmux shell<tab>` now completes to `if-shell` and
`run-shell`, though no additional information is provided.

(cherry picked from commit 27e5ed7456ff6faa59c747ee3cfb0f95850d6ee5)
2025-01-28 21:41:43 +08:00
Ilya Grigoriev
a62bae9e8f tmux completions: complete shell commands
(cherry picked from commit bcc69da5697d6278b032fac4f5f597946a02dbd2)
2025-01-28 21:41:32 +08:00
Johannes Altmanninger
28d4fc33d8 fixup missing function 2025-01-27 06:59:18 +01:00
Johannes Altmanninger
7dc046b959 Fix regression causing crash in token history search
I'm not yet sure how to reproduce 4dfcd4cb4e (reader: Check bounds
for color, 2022-08-26).  Commit 55fd43d86c (Port reader, 2023-12-22)
accidentally changed historical behavior, fix that.

Fixes #11096
2025-01-27 06:34:35 +01:00
Johannes Altmanninger
9882849fda Fix regression causing builtin commandline to report wrong relative cursor
Regressed in 55fd43d86c (Port reader, 2023-12-22).

Cherry-picked from c651a79c
2025-01-26 15:55:35 +01:00
Johannes Altmanninger
92582d5b1f Back out "Escape : and = in file completions"
If you don't care about file paths containing '=' or ':', you can
stop reading now.

In tokens like

	env var=/some/path
	PATH=/bin:/usr/local/b

file completion starts after the last separator (#2178).

Commit db365b5ef8 (Do not treat \: or \= as file completion anchor,
2024-04-19) allowed to override this behavior by escaping separators,
matching Bash.

Commit e97a4fab71 (Escape : and = in file completions, 2024-04-19)
adds this escaping automatically (also matching Bash).

The automatic escaping can be jarring and confusing, because separators
have basically no special meaning in the tokenizer; the escaping is
purely a hint to the completion engine, and often unnecessary.

For "/path/to/some:file", we compute completions for "file" and for
"/path/to/some:file".  Usually the former already matches nothing,
meaning that escaping isn't necessary.

e97a4fab71 refers us to f7dac82ed6 (Escape separators (colon and
equals) to improve completion, 2019-08-23) for the original motivation:

	$ ls /sys/bus/acpi/devices/d<tab>
	$ ls /sys/bus/acpi/devices/device:
	device:00/ device:0a/ …

Before automatic escaping, this scenario would suggest all files from
$PWD in addition to the expected completions shown above.

Since this seems to be mainly about the case where the suffix after
the separator is empty,

Let's remove the automatic escaping and add a heuristic to skip suffix
completions if:
1. the suffix is empty, to specifically address the above case.
2. the whole token completes to at least one appending completion.
   This makes sure that "git log -- :!:" still gets completions.
   (Not sure about the appending requirement)

This heuristic is probably too conservative; we can relax it later
should we hit this again.

Since this reverts most of e97a4fab71, we address the code clone
pointed out in 421ce13be6 (Fix replacing completions spuriously quoting
~, 2024-12-06). Note that e97a4fab71 quietly fixed completions for
variable overrides with brackets.

	a=bracket[

But it did so in a pretty intrusive way, forcing a lot of completions
to become replacing. Let's move this logic to a more appropriate place.

---

Additionally, we could sort every whole-token completion before every
suffix-completion.  That would probably improve the situation further,
but by itself it wouldn't address the immediate issue.

Closes #11027

(cherry picked from commit b6c249be0c4f075a9e7d65f94fd1677da2c58e72)
2025-01-23 09:03:07 +08:00
Johannes Altmanninger
8eb5e36aa6 Swap code blocks for completing separator suffix resp. whole token
Mainly to make the next commit's diff smaller. Not much functional
change: since file completions never have the DONT_SORT flag set,
these results will be sorted, and there are no data dependencies --
unless we're overflowing the max number of completions.  But in that
case the whole-token completions seem more important anyway.

(cherry picked from commit 0cfc95993a8e79de108cdc4970a623b746e34c04)
2025-01-23 09:03:07 +08:00
Fabian Boehm
fd3ed7cfa5 functions/__fish_cancel_commandline: Follow rename of bind function
See #10935
2025-01-22 17:44:28 +01:00
David Adam
4c9dfcc5d7 CHANGELOG: work on 4.0.0 2025-01-21 00:06:40 +08:00
Johannes Altmanninger
4024d82412 Fix double expansion of tokenized command line
Commit 798527d79a (completions: fix double evaluation of tokenized
commandline, 2024-01-06) fixed some completions such as the "watchexec"
ones by adding "string escape" here:

	set argv (commandline -opc | string escape) (commandline -ct)

This fixed double evaluation when we later call `complete -C"$argv"`.

Unfortunately -- searching for "complete -C" and
"__fish_complete_subcommand" -- it seems like that commit missed some
completions such as sudo.  Fix them the same way.

Alternatively, we could defer expansion of those arguments (via
--tokens-raw), since the recursive call to completion will expand
them anyway, and we don't really need to know their value.

But there are (contrived) examples where we do want to expand first,
to correctly figure out where the subcommand starts:

	sudo {-u,someuser} make ins

By definition, the tokens returned by `commandline -opc` do not
contain the token at cursor (which we're currently completing).
So the expansion should not hurt us. There is an edge case where
cartesian product expansion would produce too many results, and we
pass on the unexpanded input. In that case the extra escaping is very
unlikely to have negative effects.

Fixes # 11041
Closes # 11067

Co-authored-by: kerty <g.kabakov@inbox.ru>
2025-01-19 19:08:38 +01:00
Fabian Boehm
1c11055241 Don't clone argv for builtins
We capture the process already, and we use argv by reference for the
other cases.

argv can be big, and this reduces allocations and thereby memory usage
and speed.

E.g. `set -l foo **` with 200k matches has 25% reduced memory usage
and ~5% reduced runtime.
2025-01-17 10:02:32 +01:00
Fabian Boehm
28fb5b5207 Fix error for "fish --foo" without option argument
Wgetopt needs a ":" at the beginning to turn on this type of error.

I'm not sure why that is now, and we might want to change it (but tbh
wgetopt could do with a replacement anyway).

Fixes #11049
2025-01-17 09:52:53 +01:00
Fabian Boehm
45439f07d7 Update tests and docs for 4.0 target 2025-01-16 13:38:26 +01:00
David Adam
452aa6c614 feature_flags: update target release for 3.8 flags to 4.0
(cherry picked from commit 24abbb6de7f0444340e27cde798f4a6d74a089f9)
2025-01-15 22:12:22 +08:00
Daniel Fleischer
8c92ea1642 Add lazygit completions (#11019)
(cherry picked from commit 29c45100fa9ebecbab4d7a2a4532bf9c96e3a1f4)
2025-01-15 21:08:12 +08:00
Fabian Boehm
d2bfb51611 Workaround Kitty spamming the log for ModifyOtherKeys
Some checks failed
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
Rust checks / clippy (push) Has been cancelled
Fixes #11040
2025-01-14 20:10:33 +01:00
Fabian Boehm
806734cc56 Make new ctrl-c behavior "clear-commandline"
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
And leave the old behavior under the name "cancel-commandline".

This renames "cancel-commandline-traditional" back to
"cancel-commandline", so the old name triggers the old behavior.

Fixes #10935
2025-01-14 20:00:31 +01:00
Branch Vincent
8e141070b2 completions: add fish-lsp (#11017)
(cherry picked from commit 7970ca55af5dab5d47729bc2e3fa2a646305faae)
2025-01-14 23:48:48 +08:00
David Adam
b009c0d480 Debian packaging: update dependencies
Some checks failed
Rust checks / clippy (push) Has been cancelled
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
Ubuntu Focal calls the package with col "bsdmainutils", which is a
transitional package on newer version of both Debian and Ubuntu.

Closes #11037.

(Adapted from commit 54fef433e9f183b9527f82326926c6092c0375b5)
2025-01-12 21:21:50 +08:00
Klaus Hipp
b3aa79e9aa Fix completion typos
Some checks failed
make test / ubuntu (push) Has been cancelled
make test / ubuntu-32bit-static-pcre2 (push) Has been cancelled
make test / ubuntu-asan (push) Has been cancelled
make test / macos (push) Has been cancelled
Rust checks / rustfmt (push) Has been cancelled
Rust checks / clippy (push) Has been cancelled
(cherry picked from commit 5c25d3c3b1192b7ec9e6c3874562669b2ed4aa0b)
2025-01-09 16:51:39 +01:00
phanium
fbf9ac8046 Fix missing of builtin token description
(cherry picked from commit ef7aa793c6e67744393dfdb93b2f51175c602d02)
2025-01-09 16:49:38 +01:00
Fabian Boehm
fb6d3c3669 type: Do not translate the type "builtin"
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
This is a functional string, it should not be translated.

And we do not translate the others.
2025-01-09 16:41:44 +01:00
César Sagaert
d6dccc3c88 DNF5 completion support (#11035)
* dnf5 completions

* address comments

(cherry picked from commit 00c7baf68cf77c84ab47a7d256c2a076de0dbc03)
2025-01-09 16:36:23 +01:00
Klaus Hipp
f36a7262db Revert "Fix typo in npm completions: isntall -> install" (#11014)
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
* Revert "Fix typo in npm completions: isntall -> install"

This reverts commit f4b01bb638fe0b8060403313fdcb617a52aca047.

* Add comments about typos in `npm` completions

(cherry picked from commit 4def0ac616a99398db18de54bb415bcc9eb320f1)
2025-01-08 08:53:33 +08:00
Fabian Boehm
8a5b1ccc17 Revert "Probe for kitty keyboard protocol support"
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
This needs to be tested more, it has shown issues in MS conhost,
and potentially others.

Changing strategy after beta isn't the greatest idea.

This reverts commit 4decacb933a5223d656b00788efcfddfa7e4aece.

See #10994
2025-01-07 20:28:24 +01:00
Steve Walker
52a2bed38c fix python completion #10943
(cherry picked from commit b574a5e4f6bf142fe05980e55ace8143e889922f)
2025-01-07 23:30:56 +08:00
Klaus Hipp
cbfbac2198 Fix completion typos for apt-build, htop and wget (#11016)
(cherry picked from commit ea4e4a4279106d481daafe3e9c7b6bc635a36ca7)
2025-01-07 21:48:23 +08:00
Klaus Hipp
a9b7dd1a9b Fix typos in docs (#11015)
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
(cherry picked from commit 9b67b2ae070bf29060e8d2c10a9d127fc1bf2dcf)
2025-01-07 21:32:23 +08:00
Johannes Altmanninger
4decacb933 Probe for kitty keyboard protocol support
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
I believe this fixes more cases than it breaks.  For example
this should fix Termux which seems to be popular among fish
users. Unfortunately I haven't yet managed to test that one.

Cherry-pick of all of
- e49dde87cc (Probe for kitty keyboard protocol support, 2025-01-03)
- 10f1f21a4f (Don't send kitty kbd protocol probe until ECHO is disabled, 2025-01-05)
- dda4371679 (Stop sending CSI 5n when querying for kitty keyboard support, 2025-01-05)
2025-01-06 11:20:10 +01:00
Johannes Altmanninger
620eed466b Retry writing some escape sequences on EINTR
Cherry-picked from bc26481558298e2172dfeb033049a2dcc1f64691.
2025-01-06 11:20:10 +01:00
Lzu Tao
33fe575112 Add more convenient key bindings for VI mode
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
To make it more familiar to vi/vim users.

In all mode, ctrl-k is bind to kill-line.

In Vi visual mode:
* press v or i turn into normal or insert mode respectively.
* press I turn to insert mode and move the cursor to beginning of line.
* because fish doesn't have upcase/locase-selection, and most people reach for
  g-U rather than g-u, g-U binds to togglecase-selection temporarily.

(cherry picked from commit f9b79926f1a9aba7da9b6fb9076c764e127ae2ef)
2025-01-05 23:00:55 +08:00
David Adam
13f7e6d0a5 docs/interactive: update key bindings added for 4.0
(cherry picked from commit 6c3150aa056f3f3c4316a0f130ae0f12850971a0)
2025-01-05 22:28:45 +08:00