Commit Graph

19543 Commits

Author SHA1 Message Date
Johannes Altmanninger
add0a9dfcd fish_indent: clean up file writing logic
Fix 7308dbc7a (fish_indent: Prevent overwriting file with identical content,
2024-07-21) in a different way by passing O_TRUNC again.
If we don't want regressions we could use code review.
2024-09-16 21:27:11 +02:00
Fabian Boehm
e27f4a3744 fish_indent: Truncate file to the size of the text
This can happen in case the formatted script is shorter, e.g. because
we ditched superfluous quotes.

Fixes #10724
2024-09-16 21:08:53 +02:00
Fabian Boehm
9fafae7a8a docs/complete: Explain -r a bit better 2024-09-15 09:44:09 +02:00
Fabian Boehm
8092af9c45 docs/prompt: Add funcsave/funced 2024-09-15 09:39:13 +02:00
Fabian Boehm
f9635b1a04 docs/argparse: Explain dashes in flag names 2024-09-15 09:39:09 +02:00
Johannes Altmanninger
1e2368f609 Fix off-by-one-error parsing \e\e prefixed sequences
Closes #10721
2024-09-14 22:56:37 +02:00
Rebecca Turner
a6c8cd6e85 Fix man completions on macOS with symlinked manpath
When `manpath` prints a symlink to a directory, `/usr/libexec/makewhatis`
ignores the entire directory:

```
$ /usr/libexec/makewhatis -o /tmp/whatis \
    (/usr/bin/manpath | string split :)
makewhatis: /Users/wiggles/.nix-profile/share/man: Not a directory
```

This means that the built-in `man` completions will not index any commands in
these directories.

If we pass the directories to `readlink -f` first, `makewhatis` correctly
indexes the `man` pages.

```
$ /usr/libexec/makewhatis -o /tmp/whatis \
    (/usr/bin/manpath | string split : | xargs readlink -f)
```
2024-09-14 13:38:33 -07:00
Kerim
bc55945072 improved vi keybind 2024-09-14 13:33:21 -07:00
Peter Ammon
8f3a034264
History to store old item offsets in Vec and not VecDeque
We used deque in C++ because this vector may be large, and so it avoids
repeated re-allocations. But VecDeque is different in Rust - it's contiguous -
so there's no benefit. Just use Vec.
2024-09-14 13:26:34 -07:00
Peter Ammon
7ac62bbca4
Remove a redundant "unsafe" specifier 2024-09-14 13:15:21 -07:00
mattmc3
0a1bf01574 docs: Update synopsis for 'set' 2024-09-14 10:29:44 +02:00
Johannes Altmanninger
5432ee1aa9 Relax history autosuggestion and highlighting if cd is wrapped
For implementation reasons, we special-case cd in several ways
1. it gets different completions (handle_as_special_cd)
2. when highlighting, we honor CDPATH
3. we discard autosuggestions from history that don't have valid path arguments

There are some third-party tools like zoxide that redefine cd ("function cd
--wraps ...; ...; end"). We can't support this in general but let's try to
make an effort.

zoxide tries to be a superset of cd, so special case 1 is still
valid but 2 and 3 are not, because zoxide accepts some paths
that cd doesn't accept.

Let's add a hack to detect when "cd" actually means something else by checking
if there is any --wraps argument.

A cleaner solution is definitely possible but more effort.

Closes #10719
2024-09-14 08:51:42 +02:00
Johannes Altmanninger
5b04f221a3 __fish_anypager: remove bat from default choice
As pointed out in
b83f3b0e98 (commitcomment-146189480)
bat is not actually useful. Also its (monochrome) output is unreadable on
my system.
2024-09-14 07:21:56 +02:00
Johannes Altmanninger
9eeed5ca12 Install fish-* man pages in default MANPATH
fish adds ~/.local/share/fish/man to its MANPATH for builtins etc.  But pages
like fish-doc are unambiguous so it seems like they should be accessible
from outside fish by default.

Closes #10711
2024-09-14 07:21:18 +02:00
Johannes Altmanninger
5ad7ab7b01 Clear some env variables in test env setup 2024-09-14 07:21:18 +02:00
Harmen
fc4dd8f4de docs: fix "theme choose None" command
The command needs an upper-case "None", not a lower case.
2024-09-13 12:21:34 +02:00
Theodor Tonum
5344576dc6 fix: pacman quiet typo 2024-09-13 09:59:56 +02:00
Kaley Main
a979b6341d Create a test that reproduces fish-shell/fish-shell#10703 2024-09-06 16:41:10 +02:00
Johannes Altmanninger
f8a720da8c Fix wildcard expansion doubling up "*/"
In some cases we add the wildcard twice.

    $ fish -c '../jj; complete -C"ls cli/*/conf/tem"'
    cli/*/*/config/templates.toml

Fix that. Test in the next commit.

There seems to be another bug in 3.7.1 where we fail to apply this completion
to the command line. This appears fixed. (FWIW we might want to revert
the quoting change in completion_apply_to_command_line(), maybe that one
accidentally fix this).

Fixes #10703
2024-09-06 16:41:10 +02:00
Fabian Boehm
325b51aca0 docs/set: Fix markup
Fixes #10697
2024-09-05 19:30:38 +02:00
Abel Chalier
65ab9e7bfc clearer wording on test.fish completions 2024-09-05 17:33:24 +02:00
may
79a9c0e0f2
add completions for git diff --color-moved and --color-moved-ws (#10698) 2024-09-03 18:00:17 -05:00
Johannes Altmanninger
77b2dcb462 Fix ctrl-c being ignored during builtin wait
Same as d21ed0fb2 (Disable terminal protocols before expanding wildcards,
2024-07-31).

Also mention a related issue in the changelog.
2024-09-01 14:08:01 +02:00
Johannes Altmanninger
15b08cbcab Make import style less noisy 2024-09-01 14:05:48 +02:00
Mahmoud Al-Qudsi
50a6dfd10d Replace a HashMap w/ a BTreeMap
The HashMap is used to generate the __fish_describe_command integration
completions. Given the nature of the allocations and the numbers that we use, a
BTreeMap would theoretically perform better. Benchmarks show a 2-9%
improvement in completion times consistently in favor of BTreeMap.
2024-08-31 14:13:41 -05:00
Mahmoud Al-Qudsi
73908f1218 fish_test_helper: Fix warnings about intentionally unused results
Warnings were appearing under GCC 13.2

(void) alone is insufficient under modern compilers, workaround with logical
negation taken from GCC bug tracker.
2024-08-31 13:16:51 -05:00
Mahmoud Al-Qudsi
ef6577db25 Update threads::thread_id() documentation 2024-08-31 12:57:13 -05:00
Mahmoud Al-Qudsi
c6bbacc703 Catch tls issues caused by linker bug
Worth including because mold is rather popular in the rust world and because the
bug affects mold versions coincident with the development of the fish rust port.

The bug affects all currently released versions of mold from 2.30.0 (Mar 2024)
onwards under at least FreeBSD (though quite likely other platforms as well).

See https://github.com/rui314/mold/issues/1338 for reference.
2024-08-31 12:48:15 -05:00
Fabian Boehm
c1d9f57107 CHANGELOG 2024-08-30 21:30:05 +02:00
Fabian Boehm
8ac06f5455 Comment why we need terminfo 0.9.0
This was attempted to relax in #10622, so before some poor packager
tries warn them against it.
2024-08-30 21:27:41 +02:00
Fabian Boehm
983746a697 fish_vi_cursor: Remove terminal checks
We keep having to extend these with new terminals, and I can no longer
find a terminal that fails this.

Even emacs' ansi-term can now at least reliably ignore the sequence.
2024-08-30 21:28:15 +02:00
Klaus Hipp
1020d830e5 Add delta completions 2024-08-30 21:02:03 +02:00
exploide
cf6391b8d3 completions: improved xxd completions
- the __fish_seen_any_argument function did not work
- the xxd_exclusive_args specification was not correct
- longer old-style options were missing
- technically short options are also old-style options in xxd
- some options were missing
2024-08-30 20:34:04 +02:00
Nihaal Sangha
5f4bc28008 Add xcodes completions 2024-08-30 20:33:01 +02:00
Nihaal Sangha
02da9fa845 Add warp-cli completions 2024-08-30 20:32:40 +02:00
Nihaal Sangha
695c7a0071 Add OpenTofu completions
This is based on the existing Terraform completions with minimal changes.
2024-08-30 20:32:18 +02:00
EmilyGraceSeville7cf
74a91afa38 feat: add jv completion 2024-08-30 20:28:23 +02:00
Fabian Boehm
848921a391 build: Forbid linking glibc statically again
Static linking against glibc has crashes depending on the name
resolution setup (I think when it needs to dlopen). It is a fundamental glibc
limitation that we cannot fix on our end.

It will crash when doing `echo ~<TAB>`.

This carves out a specific exception for "gnu", i.e. glibc, targets.

Other targets, including musl and other operating systems, continue to
allow static linking.
2024-08-30 18:35:31 +02:00
Mahmoud Al-Qudsi
5278259312 Don't break out of panic handler
The previous control flow logic wasn't sound and would leave the shell in a hung
state when `break` would be encountered.

The behavior is now straightforward, the shell reads until <Enter> or <q> is
pressed, at which point it aborts.
2024-08-28 17:38:05 -05:00
Mahmoud Al-Qudsi
4d0aa2b5dd Fix panic handler
It wasn't actually exiting and would basically block indefinitely after reading
from stdin.
2024-08-28 17:29:56 -05:00
Fabian Boehm
7b7d16da48 Revert libc time_t changes
This was based on a misunderstanding.

On musl, 64-bit time_t on 32-bit architectures was introduced in version 1.2.0,
by introducing new symbols. The old symbols still exist, to allow programs compiled against older versions
to keep running on 1.2.0+, preserving ABI-compatibility. (see musl commit 38143339646a4ccce8afe298c34467767c899f51)

Programs compiled against 1.2.0+ will get the new symbols, and will therefore think time_t is 64-bit.

Unfortunately, rust's libc crate uses its own definition of these types, and does not check for musl version.
Currently, it includes the pre-1.2.0 32-bit type.

That means:

- If you run on a 32-bit system like i686
- ... and compile against a C-library other than libc
- ... and pass it a time_t-containing struct like timespec or stat

... you need to arrange for that library to be built against musl <1.2.0.

Or, as https://github.com/ericonr/rust-time64 says:

> Therefore, for "old" 32-bit targets (riscv32 is supposed to default to time64),
> any Rust code that interacts with C code built on musl after 1.2.0,
> using types based on time_t (arguably, the main ones are struct timespec and struct stat) in their interface,
> will be completely miscompiled.

However, while fish runs on i686 and compiles against pcre2, we do not pass pcre2 a time_t.
Our only uses of time_t are confined to interactions with libc, in which case with musl we would simply use the legacy ABI.

I have compiled an i686 fish against musl to confirm and can find no issue.

This reverts commit 55196ee2a0.
This reverts commit 4992f88966.
This reverts commit 46c8ba2c9f.
This reverts commit 3a9b4149da.
This reverts commit 5f9e9cbe74.
This reverts commit 338579b78c.
This reverts commit d19e5508d7.
This reverts commit b64045dc18.

Closes #10634
2024-08-27 14:28:00 +02:00
Mahmoud Al-Qudsi
46c1f0e338
Add kqueue-based uvar notifier for BSD (#10674)
Add kqueue-based uvar notifier for BSD

Tested under FreeBSD 13.3.

This also works under all versions of macOS, and has some
benefits over the current notifyd choice.

Mutex is used because of the non-mut `notification_fd_became_readable()` `&self`
reference, but contention is not expected.
2024-08-26 17:10:26 -05:00
Nadir Fejzic
28a5bac560 fix: add ghostty to terminals that support vi cursors 2024-08-26 20:18:59 +02:00
Peter Ammon
91ffa8ab48
Revert "Resume repainting command line when colors change"
This reverts commit 313bd558da.

Per discussion in 313bd558da
2024-08-25 18:41:31 -07:00
EmilyGraceSeville7cf
0954ec2596
feat: add yajsv completion 2024-08-24 16:30:52 -07:00
Dezhi Wu
04a4e5c4e7 Add completions for jj
Jujutsu (jj) is a powerful version control system for software projects.

More information can be found at https://github.com/martinvonz/jj
2024-08-24 15:26:18 -07:00
Peter Ammon
313bd558da
Resume repainting command line when colors change
This restores a hack to trigger a command line repaint when "$fish_color_*" or
"$fish_pager_color_*" changes. These allow the command line to react immediately
to changes in other sessions or web_config.

This was removed in ff62d172e5 but there does not
appear to be a handler which actually redraws these.

Revert of ff62d172e5
2024-08-24 15:02:14 -07:00
Johannes Altmanninger
5918bca1eb Make "complete -e" prevent completion autoloading
We do the same for functions.

Closes #6716
2024-08-24 08:30:52 +02:00
Mahmoud Al-Qudsi
f3d59abc46 Remove unnecessary reference 2024-08-20 14:48:59 -05:00
Mahmoud Al-Qudsi
6c37103b7c unescape_yaml_fish_2_0: Remove MaybeUninit::assume_init()
The generated assembly is more or less the same and the previously generated
version had been manually verified, but this PR removes the usage of
`MaybeUninit::assume_init()` and replaces it with direct pointer writes.

This should result in no observable change: it continues to pass the functional
tests and benchmarks identically. The safety of the new code has been verified
with Miri.

[0]: https://github.com/mqudsi/fish-yaml-unescape-benchmark
2024-08-20 14:27:59 -05:00