Commit Graph

20267 Commits

Author SHA1 Message Date
Farhood Etaati
48306409ef Adds git subtree completion
Closes #11063
2025-03-15 21:54:25 +01:00
Johannes Altmanninger
a18680cb53 timer: use write! instead of intermediate format!
See #10937
2025-03-15 21:54:25 +01:00
Sander Machado
f4a8368c9e builtins: idiomatic error code passing
Remaining code smells:
- exec_subshell_internal needs to convert a number to a result

Closes #10948
2025-03-15 21:30:49 +01:00
Ilya Grigoriev
bdb8f7da3a completion/tmux: quick fixup to conflict resolution in b85e405
Delete a line that should have been replaced with the following line (with --keep-order)

Closes #11288
2025-03-15 21:24:17 +01:00
Johannes Altmanninger
f43b16b1cb completions/pulumi: disable update check
As seen in GitHub Actions:

	132/193 Test  #17: check-completions.fish ...................***Failed   16.28 sec
	checks/check-completions.fish..Failure:

	  There were no remaining checks left to match stdout:1:
	    OUTPUT from /home/runner/work/fish-shell/fish-shell/share/completions/pulumi.fish: warning: A new version of Pulumi is available. To upgrade from version '3.154.0' to '3.156.0', visit https://pulumi.com/docs/install/ for manual instructions and release notes.
2025-03-15 21:24:17 +01:00
Fabian Boehm
65eb6cfbfe docs: Remove pre-2.4 caveats
2.4 is almost 9 years old and 69% of commits to fish behind. It is
well past worth mentioning.
2025-03-15 16:36:13 +01:00
Fabian Boehm
19267ce3fc completions/pulumi: Silence stderr
This apparently checks for updates and warns if one is available on
start.

I don't love it.
2025-03-15 12:59:27 +01:00
Ilya Grigoriev
b85e4057bc completions/tmux: show all session panes in pane completions
This makes several changes:

- All panes in the current session are now show, instead of just the
  current window.

- Instead of using window names when referring to panes (e.g.
  "fish-dev.1"), we now use either window indicies ("3.1") or absolute
pane ids (%12). This is mainly because several windows often share the
same window name, e.g. many of my panes are automatically named "fish"
if they are currently running the shell and nothing else.

  I put the window names in the descriptions. Because fish uses the
descriptions for completions, completing `fish-dev` is still helpful.

- I include the pane name into the description for a similar reason,
  truncated to 15 chars.

- The panes are now ordered carefully, with panes in this window listed
  first, then panes are ordered by window, and finally panes are listed
by their id (which does not change when panes are moved between windows)

Example output after `tmux selectp -t <TAB>` for a session with a few
windows. Note that windows 0, 1, and 4 are all named
`fish`. A pane in the current window can be accessed in 3 ways: `3`,
`2.3`, or `%57`.


```
0         (%4 [fish-dev] ~/d/fish-shell <active pane>)  3.1                    (%58 [fish] man tmux ~/.c/f...)
1     (%8 [fish-dev] hwatch "jj.logs... <active win.>)  4.0                     (%1 [sshd] tmux rename-win...)
2    (%15 [fish-dev] /U/i/d/fish-she... <active win.>)  %1                     (4.0 [sshd] tmux rename-win...)
3        (%57 [fish-dev] ~/d/fish-shell <active win.>)  %4       (2.0 [fish-dev] ~/d/fish-shell <active pane>)
0.0                                    (%100 [fish] ~)  %8   (2.1 [fish-dev] hwatch "jj.logs... <active win.>)
1.0                         (%11 [fish] ~/d/_/nixpkgs)  %11                         (1.0 [fish] ~/d/_/nixpkgs)
1.1                    (%38 [fish] ~/.c/f/completi...)  %15  (2.2 [fish-dev] /U/i/d/fish-she... <active win.>)
2.0       (%4 [fish-dev] ~/d/fish-shell <active pane>)  %38                    (1.1 [fish] ~/.c/f/completi...)
2.1   (%8 [fish-dev] hwatch "jj.logs... <active win.>)  %41                         (3.0 [fish] ~/.c/f/conf.d)
2.2  (%15 [fish-dev] /U/i/d/fish-she... <active win.>)  %57      (2.3 [fish-dev] ~/d/fish-shell <active win.>)
2.3      (%57 [fish-dev] ~/d/fish-shell <active win.>)  %58                    (3.1 [fish] man tmux ~/.c/f...)
3.0                         (%41 [fish] ~/.c/f/conf.d)  %100                                    (0.0 [fish] ~)
```

Compared to before:

```
0  (pane)  2  (pane)  0:fish-dev.0  (session:window.pane)  0:fish-dev.2  (session:window.pane)  fish-dev  (window)
1  (pane)  3  (pane)  0:fish-dev.1  (session:window.pane)  0:fish-dev.3  (session:window.pane)
```

Note that the "before" version describes the same 3 panes several times
in a row, and all the entries involving "fish-dev" are suspect since
there could be another "fish-dev" window (or, more likely, this window
and others could all be named "fish").

Closes #11115
2025-03-15 12:30:00 +01:00
Ilya Grigoriev
f30a85f538 completions/tmux: more send-keys completions, add switch-client key table argument
The switch client option is a bit weird (why does this command have a
key table-related function?), but seems helpful to add.
2025-03-15 12:27:20 +01:00
Ilya Grigoriev
5fecc2e355 completions/tmux: fixups to key table commands, update to post-2017 tmux
There are some minor updates.

Also, the syntax seems to have changed in tmux 2.4 in 2017,
ef68debc8d/CHANGES (L1484)

Notably, many of the key table commands now use `-T` in place of
the correct `-t`, and the list of key binding tables has changed.
2025-03-15 12:27:20 +01:00
Yann Soubeyrand
052a010b57 feat(completions): add argocd, cue, dagger, kubebuilder and pulumi
These tools use the Cobra framework for argument parsing, which can
generate completions ready to be sourced.
2025-03-15 12:27:14 +01:00
lengyijun
517b02899a doc: bind ctrl-c clear-commandline 2025-03-15 10:58:34 +01:00
Fabian Boehm
411a396fa9 tests: Just check that the version starts with a digit
Our versions look like

4.0.0
4.0b1
4.0.1-535-abfef-dirty

But packagers may want to add more information here, and we don't
really care. Note that we no longer ever set the version to "unknown"
since 5abd0e46f5.

Supersedes #11173
2025-03-15 10:54:12 +01:00
Johannes Altmanninger
9f79fe17fc Quote only unique completions, use backslashes for ambiguous ones
Commit 29dc307111 (Insert some completions with quotes instead of backslashes,
2024-04-13) breaks some workflows. Given

	touch '[test] file1'
	touch '[test] file2'
	ls tes<Tab>

we insert completions quoted, which is inconvenient when using globs.

This implicit quoting feature is somewhat minor. But quotes look nicer,
so let's try to keep them.  Either way, users can ask for it by starting a
token with «"».

Use quoting only when we insert unique completions.

Closes #11271
2025-03-14 22:21:42 +01:00
Fabian Boehm
c03de2086a screen: Fix crash if prompt contains backspace
fish_wcwidth_visible can return -1, so usize::try_from fails.

Fixes #11280
2025-03-14 16:23:33 +01:00
Fabian Boehm
6627d403d3 tests: Override __fish_print_help
This effectively disables "--help", replacing it with just a stand-in
string.

The upshot is that it makes the test suite immune to whether or not it
can find the documentation - until now it needed to *not* find it,
which is weird.

(also it saves some useless lines)

Fixes #11270
2025-03-13 18:13:10 +01:00
Fabian Boehm
7224776f80 staticbuilds: Build fish_indent/key_reader binaries to test 2025-03-13 16:38:21 +01:00
Fabian Boehm
6d93e6324a staticbuilds: Rename files
Use x86_64 instead of amd64 because that's what uname calls it,
and try to get the version in there.
2025-03-13 16:32:41 +01:00
David Adam
1477bf7a54 CHANGELOG: fix formatting 2025-03-13 15:48:52 +08:00
David Adam
298d79ef58 CHANGELOG: actually #10838 is out entirely 2025-03-13 12:04:15 +08:00
David Adam
3a86f8e6c7 CHANGELOG: correct version that #10838 is in 2025-03-13 12:01:14 +08:00
David Adam
a1b50b1a0e Merge branch 'Integration_4.0.1' 2025-03-13 12:00:31 +08:00
David Adam
67b6afffd4 Release 4.0.1 4.0.1 2025-03-13 11:16:55 +08:00
David Adam
6df88e1a9f CHANGELOG: work on 4.0.1 2025-03-13 10:59:58 +08:00
David Adam
f8202408f9 cmake: specify MSRV 2025-03-13 10:47:47 +08:00
Johannes Altmanninger
61884bda36 Fix GitHub Actions build now that images come with ninja
Looks like the github actions image now has ninja installed.
This causes a failure; we effectively do

	$ (
		mkdir build && cd build
		cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
	  )
	$ make VERBOSE=1
	[...]
	cd build; cmake .. -G "Ninja" \
		-DCMAKE_INSTALL_PREFIX="/usr/local" -DCMAKE_EXPORT_COMPILE_COMMANDS=1
	Re-run cmake no build system arguments
	CMake Error: Error: generator : Ninja
	Does not match the generator used previously: Unix Makefiles
	Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

"make" fails because it runs from top-level, with GNUMakefile's logic to
use -GNinja if available.  This is at odds with the direct cmake invocation,
which defaults to -G'Unix Makefiles'.

We shouldn't mix direct cmake invocation and the top-level Makefiles, so
run make from the build directory instead.

While at it, update some test invocations missed in 8d6fdfd9de
(Remove cmake "test" target, 2025-02-02).  This should
help avoid missing test failure output in CI, see
https://github.com/fish-shell/fish-shell/issues/11116#issuecomment-2629406479

(cherry picked from commit b0be53ed6a)
2025-03-13 10:36:28 +08:00
David Adam
66584dadcc CHANGELOG: work on 4.0.1 2025-03-12 23:28:29 +08:00
Johannes Altmanninger
d2cf002e64 Note that only rustup<=1.27 works OOTB for bisecting
See b38551dde9 (Drag FindRust.cmake back into the land of the living,
2025-03-05).
2025-03-12 08:40:44 +01:00
David Adam
5944518e6e docs/fish_title: add example on disabling title changing
Work on #11241.

(cherry picked from commit 3c8e058b75)
2025-03-12 14:39:33 +08:00
David Adam
3c8e058b75 docs/fish_title: add example on disabling title changing
Work on #11241.
2025-03-12 14:36:40 +08:00
Johannes Altmanninger
19502ff9e7 Add hack to fix off-by-one error in Vi-mode cancel-commandline
The new cursor-end-mode "inclusive" (which is active in Vi mode) is causing
many issues.

One of them is because cancel-commandline wants to move to the end of the
command line before printing "^C".  Since "inclusive" cursor mode prevents
the cursor from moving past the last character, that one will be overwritten
with a "^".  Hack around this.

Closes #11261

(cherry picked from commit b08ff33291)
2025-03-11 20:24:04 +01:00
Johannes Altmanninger
b08ff33291 Add hack to fix off-by-one error in Vi-mode cancel-commandline
The new cursor-end-mode "inclusive" (which is active in Vi mode) is causing
many issues.

One of them is because cancel-commandline wants to move to the end of the
command line before printing "^C".  Since "inclusive" cursor mode prevents
the cursor from moving past the last character, that one will be overwritten
with a "^".  Hack around this.

Closes #11261
2025-03-11 20:23:30 +01:00
Johannes Altmanninger
5b94af6367 Restore cursor shape when deactivating Vi mode
Running

	fish_vi_key_bindings
	fish_default_key_bindings

ought to maintain cursor shape, at least in the default configuration,
so let's do that.

Fixes 9ef76860e6 (Default Vi cursor shapes for insert/replace mode, 2024-10-26).
2025-03-11 20:22:27 +01:00
lengyijun
18c4ee4b41 cleanup: rm strange code block 2025-03-11 20:01:49 +01:00
Johannes Altmanninger
b0be53ed6a Fix GitHub Actions build now that images come with ninja
Looks like the github actions image now has ninja installed.
This causes a failure; we effectively do

	$ (
		mkdir build && cd build
		cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
	  )
	$ make VERBOSE=1
	[...]
	cd build; cmake .. -G "Ninja" \
		-DCMAKE_INSTALL_PREFIX="/usr/local" -DCMAKE_EXPORT_COMPILE_COMMANDS=1
	Re-run cmake no build system arguments
	CMake Error: Error: generator : Ninja
	Does not match the generator used previously: Unix Makefiles
	Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

"make" fails because it runs from top-level, with GNUMakefile's logic to
use -GNinja if available.  This is at odds with the direct cmake invocation,
which defaults to -G'Unix Makefiles'.

We shouldn't mix direct cmake invocation and the top-level Makefiles, so
run make from the build directory instead.

While at it, update some test invocations missed in 8d6fdfd9de
(Remove cmake "test" target, 2025-02-02).  This should
help avoid missing test failure output in CI, see
https://github.com/fish-shell/fish-shell/issues/11116#issuecomment-2629406479
2025-03-11 00:46:41 +01:00
Johannes Altmanninger
e37e1b8f78 Fix regression causing glitches when prompt has control character
Since commit 0627c9d9af (Render control characters as Unicode Control Pictures,
2020-08-29), we render control character in the commandline as "␇" etc.
They can be inserted via either history search, or bindings such as

	bind ctrl-g "commandline -i \a"

That commit incorrectly assumes that the prompt is rendered the same way as
the command line (which goes through "ScreenData" etc).
This is wrong -- prompt text is written to stdout as-is, and a prompt that
outputs \t (tab) or \a (BEL) is valid.  The wrong assumption means that we
overestimate the width of prompts containing control characters.

(For some reason, after switching from Vi insert to Vi normal mode, we seem
to get the width right which means the command line jumps around)

Let's revert to the old width computation for any prompt text.

Closes #11252

(cherry picked from commit 4d81cf8af4)
2025-03-11 00:03:34 +01:00
Johannes Altmanninger
4d81cf8af4 Fix regression causing glitches when prompt has control character
Since commit 0627c9d9af (Render control characters as Unicode Control Pictures,
2020-08-29), we render control character in the commandline as "␇" etc.
They can be inserted via either history search, or bindings such as

	bind ctrl-g "commandline -i \a"

That commit incorrectly assumes that the prompt is rendered the same way as
the command line (which goes through "ScreenData" etc).
This is wrong -- prompt text is written to stdout as-is, and a prompt that
outputs \t (tab) or \a (BEL) is valid.  The wrong assumption means that we
overestimate the width of prompts containing control characters.

(For some reason, after switching from Vi insert to Vi normal mode, we seem
to get the width right which means the command line jumps around)

Let's revert to the old width computation for any prompt text.

Closes #11252
2025-03-11 00:03:12 +01:00
Johannes Altmanninger
5d31be1c3e Fix regression causing crash on empty paste in Vi-mode
Fixes d51f669647 (Vi mode: avoid placing cursor beyond last character,
2024-02-14).

Closes #11256

(cherry picked from commit 2b4f150883)
2025-03-10 22:38:38 +01:00
Johannes Altmanninger
2b4f150883 Fix regression causing crash on empty paste in Vi-mode
Fixes d51f669647 (Vi mode: avoid placing cursor beyond last character,
2024-02-14).

Closes #11256
2025-03-10 22:28:40 +01:00
Johannes Altmanninger
ea6e819a33 completions/set: add fish_cursor_* variables 2025-03-10 22:28:40 +01:00
metamuffin
7a959723ef Print newline on path warnings to stderr instead of stdout (Rust port regression)
(cherry picked from commit 4227f534b4)
2025-03-09 14:13:44 +01:00
metamuffin
4227f534b4 Print newline on path warnings to stderr instead of stdout 2025-03-09 14:12:32 +01:00
Peter Ammon
7d3b157f13 Allow sprintf! macros to accept format string only
This allows something like `sprintf!("foo")`. Previously this was a compile time
error.

Fixes #11243
2025-03-08 20:26:03 -08:00
Peter Ammon
ad0feab86c Fix a Sphinx warning 2025-03-08 10:53:06 -08:00
Peter Ammon
2ecd0d011b Fix some clipplies 2025-03-08 10:52:27 -08:00
Johannes Altmanninger
ad7631093d Remove assertion about history items
For unknown reasons this assertion fails.  This means that 1b9b893169 (After
reading corrupted history entry, keep reading older entries, 2024-10-06)
is not fully working.  Go back to historical behavior for now.

Closes #11236

(cherry picked from commit 4f80e5cb54)
2025-03-08 13:14:44 +01:00
Johannes Altmanninger
2930c85926 Add hack to restore cursor position on undo ofter exec again
See f2dde229aa (Revert changes to restore cursor position after undo,
2025-03-05).

I think there are two problems with tmux when doing a final redraw of a
larger-than-screen commandline.  One is easy to trigger independent of
f2dde229aa.  The other is reproduced by the broken output in the tmux test
removed by that commit. Should root-cause them later.

Use a hack for now; this also happens to fix the broken output in tmux.
2025-03-08 13:12:38 +01:00
Johannes Altmanninger
4f80e5cb54 Remove assertion about history items
For unknown reasons this assertion fails.  This means that 1b9b893169 (After
reading corrupted history entry, keep reading older entries, 2024-10-06)
is not fully working.  Go back to historical behavior for now.

Closes #11236
2025-03-08 13:12:23 +01:00
Johannes Altmanninger
bd8d268255 Extend midnight commander workaround for when numlock/capslock is active
Midnight Commander 4.8.33 knows how to read the CSI u encoding of ctrl-o
(which is the only key it reads while the shell is in control).  But it fails
to when numlock or capslock is active.  Let's disable the kitty keyboard
protocol again until mc indicates that this is fixed.

Closes #10640

The other issue talked about in that issue is an unrelated mc issue, see
https://github.com/MidnightCommander/mc/issues/4597#issuecomment-2705900024
2025-03-07 12:14:56 +01:00
Niklas Liechti
90218821f9 Split content of *KnownHostsFile as this is a supported config option by ssh. 2025-03-06 21:53:30 -08:00