Commit Graph

19504 Commits

Author SHA1 Message Date
Fabian Boehm
6fe192606a functions/history: Set variables in function-scope explicitly
```fish
set -g LESS foo

history search bar
```

changes the global $LESS and exports it.
2024-11-21 18:27:10 +01:00
Fabian Boehm
11f11e27a1 functions/history: Remove unnecessary code
These things are all handled in the builtin
2024-11-21 18:26:47 +01:00
Kid
31b15405e9
Add completion for path basename -E/--no-extension (#10863) 2024-11-20 15:06:53 -06:00
Mahmoud Al-Qudsi
edd82be58d Fix crash on invalid CSI parameters
If a semicolon-delimited list of CSI parameters contained an (invalid) long
sequence of ascii numeric characters, the original code would keep multiplying
by ten and adding the most recent ones field until the `params[count][subcount]`
u32 value overflowed.

This was found via automated fuzz testing of the `try_readch()` routine against
a corpus of some proper/valid CSI escapes.
2024-11-20 15:01:34 -06:00
Mahmoud Al-Qudsi
b92830cb17 Change readch() into try_readch()
This lets us call into the entirety of the prior `readch()` with an exhaustible
input stream without panicking on the `unreachable!()` call. The previous
functionality is kept under the old name by calling `try_readch()` with the
`blocking` parameter set to `true` (100% same behavior as before).

While the `try_readch(false)` entrypoint isn't used directly by the current fish
codebase, it is required in order to automate input reader tests without the
overhead and complexity of running the test harness in a tty emulator emulator
like pexpect or tmux, which moreover necessitates out-of-process testing – which
is incompatible with most perf-guided testing harnesses.

I hope to be able to upstream harness integrations using this entry point in the
near future.
2024-11-20 14:53:07 -06:00
Fabian Boehm
b3108c0cee CHANGELOG 2024-11-19 21:12:44 +01:00
Fabian Boehm
7a667b4f6d Add basic completions for firejail
These are pretty basic, but get us roughly up to the level of the
official completions (that are also incomplete and offer disabled
options).

Fixes #10858
2024-11-18 16:16:07 +01:00
Peter Ammon
c4bc6b6f09
Clean up print_help
`print_help` is a hacky-wacky function used to support the `--help` command
of `fish_key_reader` and others. The Rust version panics on an error; fix
that and make it print more useful help messages.
2024-11-17 17:03:34 -08:00
Unbelievable Mystery
262e2d5fe6
Update completions for: wine (#10789)
* feat(function): move cmd completion function to a separate file

* feat(completion): support wine cmd subcommand

* feat(completion): support wine control subcommand

* feat(completion): support wine eject subcommand

* feat(completion): support wine explorer subcommand

* feat(completion): support wine explorer subcommand for desktops

* feat(completion): support wine start subcommand

* feat(completion): support wine winemenubuilder subcommand

* feat(completion): support wine winepath subcommand

* fix(function): rename function for cmd argument completion

* feat(function): implement function to complete registry keys

* feat(completion): support wine regedit subcommand

* feat(function): add top-level key descriptions

* fix(completion): remove redundant comment

* feat(completion): support wine msiexec subcommand

* refactor(completion): group code into functions

* feat(completion): enhance subcommand descriptions
2024-11-17 14:58:21 -08:00
Unbelievable Mystery
93aa5a9376
Add completions for: guile, guild (#10792)
* feat(completion): support guile command

* feat(completion): support guild command

* feat(completion): support guild subcommand

* feat(completion): squeeze code
2024-11-17 14:08:19 -08:00
Peter Ammon
642eff9e1f
Fix some clippies and remove some dead code 2024-11-17 12:37:45 -08:00
Next Alone
723e5a8417 completions(ollama): ollama need no files as i know (#10851)
Closes #10851.

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
2024-11-17 10:05:42 -06:00
David Adam
0e6171b63e CHANGELOG: work on 4.0.0 2024-11-17 23:12:46 +08:00
David Adam
98fcb1c6ba completions/diskutil: list all volumes, not just the writeable ones
Discussion in #10574.
2024-11-17 22:06:54 +08:00
Xiretza
421e27b1bf Add completions for iftop 2024-11-17 21:59:08 +08:00
Johannes Altmanninger
13f0c9b0c6 Remove accidentally added file 2024-11-17 05:20:35 +01:00
Johannes Altmanninger
2d8fcbcdcd Fix regression causing mbrtowc(argv) to be called before setlocale()
Fixes #10847
2024-11-16 20:46:06 +01:00
Mahmoud Al-Qudsi
68b9f96f84 Add completions for simonw/llm 2024-11-16 13:27:29 -06:00
Johannes Altmanninger
913860bd1c Fix regression causing alt-right to stop at autosuggestion
Fixes #10839
2024-11-16 13:05:44 +01:00
Johannes Altmanninger
ca21872d14 Clean up the accept-autosuggestion code path a little bit
It's still a bit too complex unfortunately.
2024-11-16 13:05:44 +01:00
vp2177
2b19e1a09b
completion(apt-mark): Add missing minimize-manual command & --color options (#10825)
* Update apt-mark.fish
2024-11-14 16:01:54 -06:00
Mahmoud Al-Qudsi
cdeb3977c3 Re-enable tmux-prompt test under FreeBSD
It passes now that we have uvar notifications working under BSD.
2024-11-14 13:44:49 -06:00
Mahmoud Al-Qudsi
fea1e3aee5 Use iterators to clean up disown logic 2024-11-14 13:25:25 -06:00
Mahmoud Al-Qudsi
c1acbf2845 Deduplicate jobs passed to disown builtin
I'm guessing this was missed in the port because there were comments referencing
using a hash set to perform the deduplication but there was no hashset. (The
TODO was added later.)
2024-11-14 13:24:55 -06:00
Fabian Boehm
366c1b7210 Refuse to search history pager if no new results exist
This prevents searching further and collapsing results into one.

Now I need to figure out how to get it to flash.
2024-11-14 20:02:49 +01:00
Mahmoud Al-Qudsi
4061ef7137 Remove unnecessary Pid::get() calls 2024-11-14 13:02:03 -06:00
Mahmoud Al-Qudsi
fc47d9fa1d Use strongly typed Pid for job control 2024-11-14 13:02:03 -06:00
Mahmoud Al-Qudsi
2cf4b12d41 Use strongly typed Option<Pid> for event handler
This caught an incorrect description for process/job exit handlers for ANY_PID
(now removed) which has been replaced with a message stating the handler is for
any process exit event.
2024-11-14 13:02:03 -06:00
Mahmoud Al-Qudsi
95ac51101e Use Option<Pid> instead of Option<pid_t>
Statically assert that the interior value is both positive and non-zero.
2024-11-14 13:02:03 -06:00
Mahmoud Al-Qudsi
3307672998 Use type safety for pid values
The previous approach of "treat this field as an `Option<NonZeroU32>` and
remember to check `p.has_pid()` before accessing it" was a mix of C++ and rust
conventions and led to some bugs or incorrect behaviors.

* `jobs -p` would previously print both the (correct) external pid and the
  (incorrect) internal value of `0` if a backgrounded command contained a
  fish function (e.g. `function foo; end; cat | foo &; jobs`)
* Updating/calculating job cpu time and usage was incorrectly including all of
  fish's cpu usage/time for each function/builtin member of the job pipeline.

Closes #10832
2024-11-14 13:02:03 -06:00
Fabian Boehm
080e40aac0 Fix crash in history pager
ctrl-r ctrl-s ctrl-s

Attemps to go before the beginning and asserts out. Instead refuse to
do that.

(there's some weirdness where it can reduce the pager to the first
entry if you keep pressing, which I haven't found yet, but that's better than *crashing*)
2024-11-14 16:36:40 +01:00
Fabian Boehm
7846a232a9 cmake: Add some new version gunk
CMake Warning (dev) at cmake/Tests.cmake:56 (add_custom_command):
  Exactly one of PRE_BUILD, PRE_LINK, or POST_BUILD must be given.  Assuming
  POST_BUILD to preserve backward compatibility.

  Policy CMP0175 is not set: add_custom_command() rejects invalid arguments.
  Run "cmake --help-policy CMP0175" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

So we just keep it the same.
2024-11-13 17:48:15 +01:00
Fabian Boehm
6d76b938c7 bind: Remove "c-" and "a-" shortcut notation
These are another way to spell the same thing that doesn't match what
`bind` would print.

They're also not documented and tested thoroughly.

Since they are just small shortcuts and unreleased we can just remove
them.

Fixes #10845
2024-11-13 17:48:15 +01:00
Mahmoud Al-Qudsi
14a5c0ca44 Disable tmux-multiline-prompt under macOS CI 2024-11-12 17:13:18 -06:00
Mahmoud Al-Qudsi
bb57f2391f Fix a bad comment and clarify delta behavior
s/fish/delta/ and provide a better explanation.
2024-11-12 09:59:10 -06:00
Mahmoud Al-Qudsi
d33cbfd1a3 Prevent delta completions from complain with old version 2024-11-11 16:51:27 -06:00
Mahmoud Al-Qudsi
4e3dc51bc4 Prevent test suite from hanging on panic 2024-11-11 16:45:13 -06:00
Fabian Boehm
960415db3f function: Error out for read-only variables
This will refuse to define the function instead of defining it with an
unusable argument.

Fixes #10842
2024-11-11 17:56:57 +01:00
Fabian Boehm
0ef811c86e dir_iter: Remove duplicate NUL-removal
This goes over the d_name twice.

Filenames already cannot contain NUL (the C-api cannot express it!), so we don't need to scan them.
2024-11-11 17:56:57 +01:00
Mahmoud Al-Qudsi
f0a3a5708f git: complete git diff src/ to show modified files before unmodified ones
This has the side effect of changing the order of completions for a bare `git
diff` to show modified files before revisions; previously they came at the very
end after all revisions, stashes, local branches, remote branches, and tags.
That seems sensible to me?

As I understand the completions file, it seems to me that the intention was for
`git diff src/` to only show modified files to begin with ­ it
previously/currently shows them all, so we might want to add a `-n 'not ...'`
condition for `git diff` to prevent that.
2024-11-10 12:55:32 -06:00
Peter Ammon
dff454b1c7
Rework git detection for macOS
fish by default shows a git-aware prompt. Recall that on macOS, there are
two hazards we must avoid:

1. The command `/usr/bin/git` is installed by default. This command is not
actually git; instead it's a stub which pops open a dialog proposing to
install Xcode command line tools. Not a good experience.
2. Even after installing these tools, the first run of any `git` or other
command may be quite slow, because it's now a stub which invokes `xcrun`
which needs to populate a cache on a fresh boot. Another bad experience.

We previously attempted to fix this by having `xcrun` print out its cache
path and check if there's a file there. This worked because `xcrun` only
lazily created that file. However, this no longer works: `xcrun` now
eagerly creates the file, and only lazily populates it. Thus we think git
is ready, when it is not.

(This can be reproduced by running `xcrun --kill-cache` and then running
the default fish shell prompt - it will be slow).

Change the fix in the following way: using sh, run `/usr/bin/git --version;
touch /tmp/__fish_git_ready` in the background. Then detect the presence of
/tmp/__fish_git_ready as a mark that git is ready.

Fixes #10535
2024-11-09 12:46:06 -08:00
Johannes Altmanninger
2543b8198d Fix crash when sprintf width argument overflows u64
Given "printf %18446744073709551616s", we parse the number only in
the printf crate, which tells us that we overflowed somwhere (but
not where exactly).
2024-11-09 08:16:08 +01:00
Mahmoud Al-Qudsi
9fddc3e887
Emit only sane pgid value for jobs output (#10833)
We were previously printing the internal `INVALID_PID` value (since removed),
which was a meaningless `-2` constant, when there was no pgid associated with a
job.

This PR changes that to `-` to indicate no pgid available, which I prefer over
something like `0` or `-1`, but will cause problems for code that is hardcoded
to convert this field to an integral value.
2024-11-08 10:33:30 -06:00
David Adam
2279b47178 CHANGELOG: work on 4.0.0
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
Lock threads / lock (push) Has been cancelled
2024-11-07 23:52:29 +08:00
Dezhi Wu
5405833822 feat(completion): Add kops.fish completion
[kOps] is a set of tools for installing, operating, and deleting Kubernetes
clusters.

[kOps]: https://github.com/kubernetes/kops/
2024-11-07 23:13:09 +08:00
Johannes Altmanninger
5e3fdf3320 Fix regression causing crash when we should clamp negative wcwidth
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
Fixes c41dbe455 (Also use control pictures for pager prefix,
2024-10-19).

Fixes #10836
2024-11-07 07:36:36 +01:00
Fabian Boehm
373c5b1e14 fixup! Cursor visible sequence
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
Whoops, picked the wrong part of cnorm
2024-11-06 19:03:50 +01:00
Fabian Boehm
56718c31b1 reader: Comment the OSC 133 marker sequences 2024-11-06 19:01:17 +01:00
Fabian Boehm
c1fbe237c9 Make cursor visible after commands
Just like we already fix terminal modes if a command left them broken,
having an invisible cursor makes the terminal hard to use and so we
fix it.

We can't really use cnorm/cursor_normal because that often includes
other gunk like making the cursor blink, but it turns out every
terminfo entry agrees on the sequence to make the cursor visible, so
we hardcode it.

Fixes #10834
2024-11-06 19:01:17 +01:00
Fabian Boehm
bfc68345c9 Disable CSI u in Jetbrains terminals
Note: This may not be sent in WSL.

Fixes #10829
2024-11-06 19:01:04 +01:00