19701 Commits

Author SHA1 Message Date
Ilya Grigoriev
c571b65221 completions: add unbuffer completions
unbuffer is sometimes bundled with `expect` (which fish already ships
completions for), and sometimes is bundled separately. It's often
recommended for forcing colors to have color output.

https://manpages.debian.org/bookworm/expect/unbuffer.1.en.html

Ads for unbuffer:

https://wiki.archlinux.org/title/Color_output_in_console#Reading_from_stdin
https://jvns.ca/blog/2024/10/01/terminal-colours/
(cherry picked from commit 4208798585c47a142a946f5e8e81695d6fdd1893)
2025-02-13 00:01:07 +08:00
David Adam
fab273cf4d BSD/GNUmakefile: update to use new fish_run_tests target
(cherry picked from commit 15ca16477376cc2ddceebcbe1c637a58edfb950f)
2025-02-12 12:09:00 +08:00
David Adam
0f346991e4 Revert "CI: Use renamed test target"
CI targets the GNUmakefile in the build root, which is probably worth keeping
working.

This reverts commit 3469fd25ec250d039a48a20fe9a6822f3f9af960.
2025-02-12 12:09:00 +08:00
Fabian Boehm
9c2bfec150 CHANGELOG keyboard-protocols feature flag 2025-02-11 22:23:31 +01:00
Fabian Boehm
9c40f72643 Add feature flag for turning off keyboard protocols
To work around terminal bugs.

The flag "keyboard-protocols" defaults to "on" and enables keyboard protocols,
but can be turned off by setting "no-keyboard-protocols".

This has downsides as a feature flag - if you use multiple terminals and
one of them can't do it you'll have to disable it in all,
but anything else would require us to hook this up to env-dispatch,
and ensure that we turn the protocols *off* when the flag is disabled.

Since this is a temporary inconvenience, this would be okay to ask
zellij and Jetbrains-with-WSL users.
2025-02-11 22:22:08 +01:00
David Adam
774ad16404 CHANGELOG: work on 4.0.0 2025-02-11 23:28:07 +08:00
idealseal
6d7a7c2254 feat(comp): update to systemd 257
(cherry picked from commit 7accf4ffa1febcbfe2d6a90222fc573be7fe4f9a)
2025-02-11 22:53:09 +08:00
Max Jacobson
e1349b9c4a Fix formatting of abbr example
I'm running fish 4.0b1 locally and I tried running `help abbr` and
browsing the docs. I noticed one example which wasn't formatted
correctly.

I'm not too familiar with rst, but based on looking at the file, it
seems that this is how example code should be represented.

(cherry picked from commit d47a4899b4179addaedd73f18cc1219bb6d9564a)
2025-02-11 22:51:24 +08:00
Ilya Grigoriev
0677c03689 completions/tmux: replace embedded tabs with \t
(cherry picked from commit 5dd6759d01afa1e1e901b966048e4dea93b237c7)
2025-02-11 22:32:22 +08:00
David Adam
1b6e107131 completions/elm: remove = in long options
elm's argument parser copes just fine without them

Review comment from
https://github.com/fish-shell/fish-shell/pull/10759#discussion_r1786918645

(cherry picked from commit 2849cd11aedcc4ba9d470ebab064f06d61212677)
2025-02-11 22:29:03 +08:00
Kemel Zaidan
7ea368b6d3 adds completion for the default Elm cli tool
(cherry picked from commit df6bd36e82d0529b475287a30678d230ead7847b)
2025-02-11 22:29:03 +08:00
Roland Fredenhagen
00b2009851 Complete entries for bootctl
Uses `jq` to parse and doesn't add these extra completions if not available.

(cherry picked from commit d862e7bf26b7e9c1558174c591287ed98431a690)
2025-02-11 22:29:03 +08:00
Fabian Boehm
47d3189614 abbr: Print optional set-cursor arg correctly
Allows the output to round-trip.

Fixes #11141

(cherry picked from commit b50c832a3533b61c8b92e01bccee413103f325d7)
2025-02-07 12:40:33 +01:00
Johannes Altmanninger
65ac71edcc Make alt-{b,f} move in directory history if commandline is empty
alt-{left,right} move in the directory history (like in browsers).
Arrow keys can be inconvenient to reach on some keyboards, so
let's alias this to alt-{b,f}, which already have similar behavior.
(historically the behavior was the same; we're considering changing
that back on some platforms).

This happens to fix alt-{left,right} in Terminal.app (where we had
a workaround for some cases), Ghostty, though that alone should not
be the reason for this change.

Cherry-picked from commit f4503af037cf596f6dc4c2b2e39df703e3fd6d07.

Closes #11105
2025-02-06 19:15:03 +01:00
Fabian Boehm
a11b9e5af7 CHANGELOG: Fix some formatting 2025-02-05 22:13:17 +01:00
Fabian Boehm
db244e0492 reader: Only maintain cursor position in non-empty prefix search
Otherwise this would always move the cursor to the beginning.

Fixes #11133
2025-02-05 22:13:14 +01:00
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