Commit graph

15876 commits

Author SHA1 Message Date
ridiculousfish
9b89f4a9a3 Remove vendored pcre2 directory
Now that PCRE2 is dynamically fetched and built, we can remove the vendored
directory.

Fixes #8355
2022-07-02 18:46:58 -07:00
ridiculousfish
5b1e106d87 cmake: Download and fetch PCRE2 rather than using vendored sources
This switches to using the CMake FetchContent path to dynamically download
and build PCRE2, allowing us to drop the vendored sources.

The FISH_USE_SYSTEM_PCRE2 CMake option is kept, but if false it now means
fetch-and-build PCRE2 rather than building vendored sources.

Note FetchContent was introduced in CMake 3.11. That is now a prerequisite
for building fish with FISH_USE_SYSTEM_PCRE2 disabled.
2022-07-02 18:46:58 -07:00
ridiculousfish
ffded81a00 Correct a misleading comment 2022-07-02 11:30:59 -07:00
Kid
e6505d1c30 file completion nuances on macOS 2022-07-02 11:33:03 +02:00
Fabian Boehm
60f87ef3be Add error for EBADARCH
That's apparently errno 86 on macOS, and it's triggered when the
architecture is wrong.

I'll leave other macOS errors to the macOS users.

See #9052.
2022-07-02 10:11:00 +02:00
Fabian Boehm
d920610f96 Fix special readline functions after and/or
Here we needed to handle self-insert immediately, but we ended up
returning it.

Fixes #9051
2022-07-02 09:23:11 +02:00
Fabian Boehm
98ba66ed8e set_color: Print the given colors with --print-colors 2022-07-01 21:28:35 +02:00
Fabian Boehm
0a73b182c0 bind: Document --silent
See #9045
2022-07-01 20:46:52 +02:00
Fabian Boehm
bd7934ccbf history: Refuse to merge in private mode
It makes *no* sense.

Fixes #9050.
2022-07-01 20:10:18 +02:00
Fabian Boehm
80fe0a7fcb fish_job_summary: Format message better for multiline prompts
This was supposed to be number of lines in the prompt minus 1, but
string repeat added one.

Also it triggered even in case of the stopped job message, which is
already repainted differently.

So we add it when we need to repaint ourselves.

As a bonus add a newline before in that case so the message isn't
awkwardly printed into the commandline.

Fixes #9044.
2022-06-28 18:03:09 +02:00
Fabian Boehm
eea9d1a5de CHANGELOG set --show showing inherited vars 2022-06-27 20:34:24 +02:00
Fabian Boehm
dde2d33098 set --show: Show the originally inherited value, if any
This adds a line to `set --show`s output like

```
$PATH: originally inherited as |/home/alfa/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/flatpak/exports/bin|
```

to help with debugging.

Note that this means keeping an additional copy of the original
environment around. At most this would be one ARG_MAX's worth, which
is about 2M.
2022-06-27 20:33:26 +02:00
Fabian Boehm
bfeebca75a tests/argparse: Use set -l
This skips history, which takes a lot of time here!
2022-06-27 17:50:40 +02:00
Fabian Boehm
04f6306a35 argparse: Stop reconverting to null_terminated_array_t
We already have a perfectly cromulent null_terminated_array here, so
just use it.

No visible changes here, possibly some memory use?
2022-06-27 17:45:08 +02:00
Fabian Boehm
842af06c5d completions/git: Cache subcommand v2
This is sort of slow because it's called hundreds of times.

We used to have a cache, introduced in ad9b4290e, but it was removed
in fee5a9125a because it had
false-positives.

So what we do, because the issue is that this is called hundreds of
times per-commandline, we cache it keyed on the commandline.

This speeds up `complete -C'git sta'` by a factor of 2.3x.
2022-06-27 17:15:30 +02:00
Fabian Boehm
0f5ce57ec7 CHANGELOG 2022-06-27 17:02:20 +02:00
Fabian Boehm
993448d552 argparse: Allow usage without optspecs
It's still useful without, for instance to implement a command that
takes no options, or to check min-args or max-args.

(technically no optspecs, no min/max args and --ignore-unknown does
nothing, but that's a very specific error that we don't need to forbid)

Fixes #9006
2022-06-27 17:02:20 +02:00
Johannes Altmanninger
fee5a9125a Revert "completions/git: cache subcommand computation"
Commit ad9b4290e optimized git completions by adding a completion that would
run on every completion request, which allows to precompute data used by
other completion entries. Unfortunately, the completion entry is not run
when the commandline contains a flag like `git -C`. If we didn't
already load git.fish, we'd error. Additionally, we got false positive
completions for `git diff -c`.

So this hack was a very bad idea. We should optimize in another way.
2022-06-26 23:02:26 +02:00
Aaron Gyes
b73091b27b proc.cpp, fish_tests.cpp: use snprintf()
Resolves this warning:

> warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
2022-06-25 16:27:04 -07:00
Rocka
c588bd5c5c completions: add qdbus completion 2022-06-25 21:59:57 +02:00
NextAlone
5642499dc2
feat: completion for reflector (#9027)
* feat: completion for reflector

* fix
2022-06-25 21:59:18 +02:00
mhmdanas
9f19ab1fba Prioritize APKs for adb install 2022-06-25 12:03:22 -07:00
exploide
459bbe208d scp completions: added new options 2022-06-25 12:02:19 -07:00
Fabian Boehm
13a9f6b64e printf: Print special error for invalid octal numbers
(tbh these were always a mistake)

See #9035
2022-06-23 18:12:43 +02:00
Michael Jarvis
d6d2c9cd1e Add placeholder text to silence sphinx-doc warning
[100%] Building HTML documentation with Sphinx
../CHANGELOG.rst:42: ERROR: Document or section may not begin with a transition.
[100%] Built target sphinx-docs

This is essentially a duplicate of commit cd1f0cc5d  :-)
2022-06-22 20:44:39 -07:00
Fabian Boehm
c1fd99188f CHANGELOG 2022-06-21 21:14:13 +02:00
Fabian Boehm
a78d085df2 Try to use xterm{-256color,} if $TERM could not be used
This is very very very likely to result in an almost fully functional
terminal, as opposed to a "minimally functional" one.
2022-06-21 21:12:04 +02:00
Fabian Boehm
a004a10a80 fish_git_prompt: Remove variables we don't care from event handler
This was called e.g. when showdirtystate was changed, but then checked
if it was called for the informative statusses only. Simply remove
them.
2022-06-21 20:22:27 +02:00
ridiculousfish
53a2484fd1 Warn the user when visiting old documentation
This enhances our documentation to look for the file
/release_version.json in the root of our site. If found, and if it
contains a RELEASE_VERSION other than this version, then unhide a banner
warning about the stale documentation and linking to the current.
2022-06-20 17:56:14 -07:00
ridiculousfish
137a4ecdf5 Clear signals after running initial commands
If you run an initial command via `fish -c`, and that command is
cancelled e.g. via control-C, then ensure that the cancellation signal
is cleared before running config files.

Fixes #9024
2022-06-20 13:28:58 -07:00
ridiculousfish
f19a2711d4 run_command_list to stop accepting its commands by pointer
There was no reason for this. No functional change here.
2022-06-20 12:55:33 -07:00
ridiculousfish
0230420983 Stop initializing principal parser at global scope
Avoid the risk of global constructors by making this a function-level
static.
2022-06-20 12:31:36 -07:00
ridiculousfish
06de0f79a1 Minor cleanup of setup_user
No functional change
2022-06-20 12:31:36 -07:00
ridiculousfish
50f6b06251 Replace a bunch of ASSERT_IS_MAIN_THREAD
Switch these to a new function parser.assert_can_execute(), in
preparation for allowing execution off of the main thread.
2022-06-20 12:31:36 -07:00
ridiculousfish
e2e340823a Bravely replace ttyname with ttyname_r
This is more thread safe. We'll see if any platforms don't have this.
2022-06-20 12:31:35 -07:00
Fabian Boehm
e98b7d1a56 CHANGELOG 2022-06-20 17:43:49 +02:00
Fabian Boehm
b4a3b9982c Activate fish_vi_cursor for tmux
Discussions with the tmux maintainer show that:

1. We no longer need the passthrough sequence at all (and it's
deactivated by default)
2. Tmux can check if the outer terminal supports cursor shaping

Fixes #8981
2022-06-20 17:42:29 +02:00
ridiculousfish
da020c0641 Remove some stuff from global_safety.h
These bits were unused and/or unnecessary.
2022-06-19 15:38:13 -07:00
ridiculousfish
96b3a86b87 Remove iothread drain flag
This was intended to support a mode where we "drain threads before fork"
but that ship has long sailed and it proved unnecessary.
2022-06-19 15:15:20 -07:00
ridiculousfish
e2782ac322 Remove iothread_perform_on_main
iothread_perform_on_main is deadlock-prone under concurrent execution.
We no longer use it, so remove it.
2022-06-19 15:15:20 -07:00
ridiculousfish
bfa83470d4 Reimplement autosuggestion-triggered completion loading
This concerns what happens if the user types e.g. `grep --i` and grep or
its completions have not yet been loaded. Previously we would "bounce to
the main thread" from within the autosuggestion thread to load grep's
completions. However under concurrent execution, this may deadlock as the
main thread is waiting for something else.

In the new implementation, complete simply records the commands that it
would autoload, and returns them back to the caller, where the caller can
decide how to handle them.

In general iothread_perform_on_main risks deadlock under concurrent
execution and we should try to get rid of it.

There should be no user-visible change from this fix.
2022-06-19 15:15:17 -07:00
ridiculousfish
0fee2fb293 Minor cleanup of complete_param_for_command 2022-06-19 11:23:10 -07:00
ridiculousfish
17bd7d0e40 Switch completion_request_options_t from a list of flags to a struct
This is simpler and allows potentially hanging more fields off of it
later.
2022-06-19 11:23:10 -07:00
Fabian Boehm
1819c7f2b8 docs: Add more specific guidance on locale variables 2022-06-17 22:08:00 +02:00
Fabian Boehm
8652a21a10 CHANGELOG: Remove superfluous backtick 2022-06-17 21:56:44 +02:00
Fabian Boehm
045683f927 tests/fd: Error out early if more fds are open
This is simply an error in test setup. There's a limit to how far we
can isolate them from the system.

(it's possible new cmake versions close fds automatically since I
can't reproduce the original issue via `ninja test` or `make test`)

Fixes #9017
2022-06-17 09:33:42 +02:00
Fabian Boehm
4f0c0486a6 Fix copy-pasteo in fish_config docs 2022-06-17 09:23:38 +02:00
Johannes Altmanninger
4fcf971f0f Changelog for #9020 2022-06-17 07:22:08 +02:00
Evan Lloyd New-Schmidt
a605bcb830 Show manpage for command under cursor
This commit lets you check the manpage for a leading command by moving
the cursor over it, matching the behavior of tab complete.

It also lets you select the man page for the base of a two-part command
like `string match`.

The additional regex case is added because
`commandline -t` returns an empty string when the cursor is after a
space, e.g. at the end of 'sudo ', which the later checks don't handle.

This diagram shows the manpage picked for different cursor positions:

    > sudo -Es time git commit -m foo
      +-------++---++--++------------+
      |       ||   ||  ||            |
      |       ||   ||  |+------------+
      |       ||   ||  |  git-commit
      |       ||   |+--+
      |       ||   | git
      |       |+---+
      |       | time
      +-------+
         sudo
2022-06-17 07:21:25 +02:00
Fabian Boehm
42a9dfa08a Start CHANGELOG for 3.6.0 2022-06-16 19:19:02 +02:00