Commit Graph

15370 Commits

Author SHA1 Message Date
Nadav Zingerman
9e0f74eb6c Add --escape option to complete -C
An example use case is an external completion pager:

    bind \cg "commandline -rt (complete -C --escape|fzf|cut -d\t -f1)\ "

Fixes #3469
2022-02-09 08:34:03 +01:00
Aaron Gyes
d1d9f147ec Update tests for time output. 2022-02-08 16:57:01 -08:00
Aaron Gyes
63bfab9975 Start threads detached. 2022-02-08 16:44:20 -08:00
Aaron Gyes
e0c8e1cd70 iothread: Remove most of a comment
Remove the narrative here that can set a reader up for confusion.

018e51c935
2022-02-08 16:44:20 -08:00
Aaron Gyes
346ce8081b time: use box drawing characterts for the separator
This spruces up output slightly to render a solid
line instead of a bunch of dashes for the horizontal
rule shown in time output.
2022-02-08 16:44:20 -08:00
Aaron Gyes
2d9e51b43e builtin time: Use more familiar time unit abbreviations
Use ms, μs as opposed to "millis", etc.
2022-02-08 16:44:20 -08:00
Mahmoud Al-Qudsi
4ea5a8a5c6 CHANGELOG.rst: Add vim text width override
If you have vim set up to recognize `.editorconfig` files, the 80-char limit
from ours causes vim to keep chopping lines. This makes it ignore that limit
when editing `CHANGELOG.rst`
2022-02-08 14:37:23 -06:00
Mahmoud Al-Qudsi
ddc4d8ba9b Changelog: fish_is_nth_token + fish_nth_token
See re-opened issue #8008 for discussion regarding the name of these functions -
this might need to be revisited pending a decision there.
2022-02-08 14:17:00 -06:00
Mahmoud Al-Qudsi
497cebab64 Changelog: OpenZFS completion improvements 2022-02-08 14:17:00 -06:00
Mahmoud Al-Qudsi
b3142a29e7 Fix zfs add completions 2022-02-08 14:17:00 -06:00
Mahmoud Al-Qudsi
5b7dd5e806 Fix zpool attach completions
The previous behavior vs the current (hopefully ideal) behavior:

* zpool attach [lists pools and devices - should list only pools]
* zpool attach tank [lists pools and devices - should list only devices already
    part of pool "tank"]
* zpool attach tank da1 [lists pools and devices - should list only devices not
    already part of pool "tank" or any pool, depending on -f flag to attach]
2022-02-08 14:17:00 -06:00
Mahmoud Al-Qudsi
b06a8a2e0c Add public function fish_nth_token to mirror fish_is_nth_token
Completions may benefit from using these in tandem to dynamically generate
completions predicated on the value of an earlier token in a cleaner fashion.
(Currently, most of called completion helper functions introspect the command
line to get the value of an earlier argument, making them less reusable for
different expressions that need completions of the same type. This way, the
completion can provide the function with the argument value explicitly.)
2022-02-08 14:17:00 -06:00
Mahmoud Al-Qudsi
99e0aa3c64 Clarify fish_is_nth_token description
Yes, this does make it longer but it's a very important point.
2022-02-08 14:17:00 -06:00
Mahmoud Al-Qudsi
8d386a27f3 zfs completions: Factor out OpenZFS features and support
As of FreeBSD 13 (released April 2021), FreeBSD has rebased its zfs support on
top of the OpenZFS distribution previously used only/chiefly by Linux;
accordingly, it has gained support for some previously Linux-only completions.
This patch changes some completions previously predicated on a Linux ZFS
installation to the presence of an OpenZFS installation. Note that there
continue to be (and probably always will be) separate Linux-only and
FreeBSD-only completions (and not just when it comes to interacting with the
device subsystem, etc).
2022-02-08 14:17:00 -06:00
Tristan McLain
06c474da2e
Shortened quilt definitions (#8667)
* shortened quilt function definitions

* fixed some changes with quilt definitions

Co-authored-by: Tristan McLain <tristan@Tristans-Laptop.localdomain>
2022-02-08 20:19:03 +01:00
Shay Aviv
2ef12af60e Fix comment parsing inside command substitutions and brackets 2022-02-08 16:20:31 +01:00
ridiculousfish
627033f447 fish_wcswidth_visible to use int instead of size_t
Credit to lilyball for spotting this.
2022-02-07 22:17:47 -08:00
Johannes Altmanninger
e8372db781 completions/set: only show foreground/background colors if relevant
Cursory experiments reveal that there are only three color options where
the background color is not ignored (though I didn't check all of them).
For these three options, the foreground color is ignored.  Similar for
bold/italics/underline.
Teach set completions to only show the colors that won't be ignored.

Unrelated observation: we write

	-a '--background=(set_color --print-colors)'

instead of

	-l background -a '(set_color --print-colors)'

because we want all colors to show straight away (there are no other
meaningful arguments).
2022-02-07 20:53:55 +01:00
Johannes Altmanninger
1a0fed2800 completions/set: fix completion of locales
4b018a760 (set completions: add more special variables, fix colors, 2021-12-13)
changed a global variable to a local, which is no longer visible to this
function. Fix this, so "set LANG <TAB>" works again.
2022-02-07 20:53:55 +01:00
Johannes Altmanninger
13edce3671 share/**.fish: reformat with fish_indent 2022-02-07 20:53:55 +01:00
Johannes Altmanninger
8b9f7dbf45 Commit transient edit when history search ends
A history search ends when you move the cursor, but the commandline inserted by
history search is still marked as transient. This means that the next history
search will clear the transient commandline. This means we are dropping an undo
point, for example:

	echo 11
	echo 1
	echo autosuggestion
	echo^P # commandline is "echo 1"
	^A # stop history search
	^P # commandline is "echo 11"
	^Z # Bug: commandline goes back to "echo", but it should be "echo 1"

In the worst case, we are switching from line-search to token-search (see
the attached test case).  Clearing the transient edit means the line is gone
and only the token is left on the command line.
2022-02-07 17:38:11 +01:00
Johannes Altmanninger
6bdb99972d editorconfig: use 80 columns for commit messages, not 100
Our current style favors < 80 columns in commit messages (or we just don't
use editorconfig here?).
2022-02-07 17:16:51 +01:00
Jakub Panek
964b7a729a completions(apk.fish): remove non-existent short flags, add prune flag
Signed-off-by: Jakub Panek <me@panekj.dev>
2022-02-06 08:41:56 +01:00
ridiculousfish
7f31acbf9b Prevent fish_title output from triggering a bel
fish outputs the result of fish_title inside an escape sequence, which
happens to be terminated by \a (BEL). It may happen that the initial
output is interrupted; fish then emits the closing BEL and that makes an
annoying beep. Output the fish_title all at once, even if a signal is
delivered (so we don't get "stuck inside" the sequence).

This is related to #8628 in that it's a "torn escape sequence."
2022-02-05 13:18:37 -08:00
ridiculousfish
1bdd629326 Prevent signals from tearing multi-char bindings
Say the user has a multi-char binding (typically an escape sequence), and a
signal arrives partway through the binding. The signal has an event handler
which enques some readline event, for example, `repaint`. Prior to this
change, the readline event would cause the multi-char binding to fail. This
would cause bits of the escape sequence to be printed to the screen.

Fix this by noticing when a sequence was "interrupted" by a non-char event,
and then rotating a sequence of such interruptions to the front of the
queue.

Fixes #8628
2022-02-05 13:18:36 -08:00
ridiculousfish
43e5004b6e readch_timed to block signals
readch_timed is called after reading the escape character \x1b. The escape
char may be a standalone key press or part of an escape sequence; fish
waits for a little bit (per the fish_escape_delay_ms variable) to see if
something else arrives, before treating it as standalone escape-key press.

It may happen that a signal is delivered while fish waits. Prior to this
change we would treat this signal as a "nothing was read" event, causing
escape to be wrongly treated as standalone.

Avoid this by using pselect() with a full signal mask, to ensure this call
completes.
2022-02-05 13:17:45 -08:00
ridiculousfish
8a4ed096ed Stop passing check_exit events to match key bindings
check_exit events are generated to give the reader a chance to respond to
commands, or otherwise to return control to the reader loop. Prior to this
change they were being passed to match key bindings. This is useless since
no key binding can match a check_exit event. FLOG noisily complains about
unmatched events. So just don't pass these to mapping_execute.
2022-02-05 13:17:45 -08:00
Johannes Altmanninger
0e6313b98b help: error out on unknown help topic
Probably too minor for a changelog?

Fixes #8698
2022-02-05 20:32:58 +01:00
Emily Grace Seville
1b12719364 Extend mono completions
Work on mono.fish
- rewrite runtime option completions

Add new mono tools:
- gacutil
- xsp
- mkbundle
- ilasm
- monodis
- ikdasm
- monop
- sqlsharp
- gendarme
- csharp

Closes #8452
2022-02-05 20:09:45 +01:00
Johannes Altmanninger
348a5b6baf Restyle detection of terminals that support OSC 7
We detect one terminal (foot) with a "string match" command, and all others in a long "test"
command.  Let's put the detection of each terminal on a new line. This should be easier to read
and change. It also allows to lose one level of indentation.
2022-02-05 20:08:06 +01:00
David Adam
065b769c1d CHANGELOG: work on 3.4.0 2022-02-03 22:42:24 +08:00
Fabian Homborg
0afb9b5709 fish_title: Shorten command to 20 characters
Otherwise this makes massive terminal tabs
2022-02-03 13:52:59 +01:00
Fabian Homborg
84e7fbd466 Make default .theme file consistent with uvars
This takes the changes from 03b23dd1b6
and applies them to the .theme version as well.

(note: It's *possible* to just go through fish_config in future, but
we do not want to do that right now because that can have issues on
upgrade)
2022-02-03 13:09:52 +01:00
Fabian Homborg
4c9e31afe9 Move color initialization back
This was an undocumented undunderscored function that wouldn't be
super useful to actually use manually (because it still checked if the
variable was set!). It also relied on `__init_uvar`, which was only
set in `__fish_config_interactive`.

Additionally it didn't remove any complexity because this was all very
simple "do thing a, do thing b, do thing c" stuff. It added a layer of
indirection instead, and made fish startup dependent on another
function.

If you want to reset your colorscheme to the default, use fish_config.
2022-02-03 13:09:52 +01:00
Jason Nader
cd3658d457 Ensure short option description is not overridden
Without this the description for `-o` was being set to "Set the page margins when printing text files"
2022-02-02 18:19:15 -08:00
Aaron Gyes
a03e245e13
Update CHANGELOG.rst 2022-02-01 00:47:18 -08:00
Aaron Gyes
6b586d3e09 non-GNU id completions 2022-02-01 00:33:11 -08:00
Aaron Gyes
8e0d192f50 mdfind: Update with shorter descriptions 2022-01-31 23:38:19 -08:00
Aaron Gyes
c75603c475 env completions: Update for FreeBSD env
This isn't perfect, NetBSD for example takes -0 but not -v, -P,
or -S.
2022-01-31 23:12:30 -08:00
Aaron Gyes
12a4091774 df completions: shorten a description 2022-01-31 22:33:16 -08:00
Aaron Gyes
1d9f34e8bf cut completions: fix for BSD/macOS
Sharpened the pencil on a few description strings as well.
2022-01-31 22:30:14 -08:00
Aaron Gyes
d40f805d94 cp completions: update for current macOS
macOS has learned a few FreeBSD flags since I put this together:
-s, -x, -l
2022-01-31 22:15:53 -08:00
Aaron Gyes
9ec359d133 update chown completions
Add completions that are correct on darwin and probably bsd.
Add missing -H, -L, -P completions to GNU chown.
Remove errant GNU completion claiming -h is short for --help.
2022-01-31 21:56:02 -08:00
Aaron Gyes
56a4920856 chgrp, chmod completions: pipe both stderr and stdout to /dev/null
Seems like --version output writes to stdout on the GNU utils.
2022-01-31 21:29:05 -08:00
Mahmoud Al-Qudsi
d059c3b5b2 src/reader.cpp: Remove needless use of macro 2022-01-31 16:28:21 -06:00
Mahmoud Al-Qudsi
05cdacc8d4 Prevent queued-up flash() calls from blocking input
Closes #8610.
2022-01-31 16:25:42 -06:00
Aaron Gyes
e575a63232 chmod completions for non-GNU chmod
And chgrp fixup.
2022-01-30 19:53:48 -08:00
Johannes Altmanninger
63960f646b completions/ln: sort flags to match the GNU ln man page 2022-01-30 15:01:29 +01:00
NextAlone
9121e14279 Add ln completion -r --relative 2022-01-30 14:34:11 +01:00
Aaron Gyes
7c022753cf chgrp: do not-GNU
Add versions for macOS.
2022-01-29 22:49:48 -08:00