Commit graph

15860 commits

Author SHA1 Message Date
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
Fabian Boehm
88b445ce9e Put short footnotes on one line again
Unlike before, this doesn't force the number to be on the same line as
strongly, that's fine.

So short footnotes look like

-------------
[1] Some text
-------------

Longer footnotes may look like

--------------
[2]

Some more text
--------------
2022-06-16 19:14:45 +02:00
Fabian Boehm
70a1febd6d Readd some missed changes
The "Warning:" on the warning (in index.html#default shell) wasn't in
the line with the text, the features list had more padding and some
headers were smaller, some table stuff
2022-06-16 19:14:45 +02:00
Fabian Boehm
e5a1da8b22 Remove unneeded guff 2022-06-16 19:14:45 +02:00
Fabian Boehm
6d8b88fb1d doc theme: Simplify
Move related stuff together and remove some unneeded guff

Specifically the weird "clear:" stuff causes rendering issues for me
in Firefox.
2022-06-16 19:14:45 +02:00
Fabian Homborg
618b0d0add Make doc css not depend on sphinx' css
This has required workarounds a few times, plus if it changes it might
break our theme. See e.g.

4712da3eb1
e27456df24
a6d484836e
85522036f5

So we import the rules we *use* and throw away the rest. Note that
this might still have rules that are no longer necessary - e.g. some
that are required to work around sphinx bugs would still be left.

It could benefit from some cleanup and simplification, and from
switching to a flex layout instead of the 230px hardcoded
sidebar - sphinx tried that, but it doesn't really work with our
narrow layout, so we disabled it again.
2022-06-16 19:14:45 +02:00
Fabian Boehm
8dbd23372f style.fish: Just ask for uncommitted changes
I keep some files around that I don't *want* to commit or ignore, but
it's fine to restyle them.

It's also fine to restyle everything if you are about to commit
something because then it'll be committed in the correct style.
2022-06-16 18:45:46 +02:00
Fabian Boehm
7d3127ac2b Use variable 2022-06-16 18:43:57 +02:00
Fabian Boehm
8f08fe80fd Restyle codebase
Not a lot of changes, tbh
2022-06-16 18:43:28 +02:00
Fabian Boehm
18433278ec Document that status fish-path is platform-specific 2022-06-16 16:39:09 +02:00
Fabian Boehm
6e0653af93 status fish-path: Remove "(deleted)" suffix
Fixes #9018.
2022-06-16 16:36:05 +02:00
Fabian Boehm
cf8b51b2a5 Use bool instead of int 2022-06-16 15:48:46 +02:00
Fabian Boehm
f41e41026c echo: Use convert_digit
Simply removes some duplicated code, no functional change.
2022-06-16 15:43:46 +02:00
Fabian Boehm
90e763b279 printf: Remove duplicated conversion functions 2022-06-16 15:43:46 +02:00
Fabian Boehm
89996c0c8a Remove debug_shared
The last remnant of the old debug system, this was only used in
show_stackframe.

Because that's only ever called with an "E" level currently I've
removed the level argument entirely. If it's needed we'd have to pass
a flog category here.
2022-06-16 15:43:42 +02:00
David Adam
98bf01568d Release 3.5.0 2022-06-16 20:49:19 +10:00
David Adam
9cbd1aa147 CHANGELOG: work on 3.5.0 2022-06-16 20:41:41 +10:00