Commit graph

13022 commits

Author SHA1 Message Date
Fabian Homborg
aecd639fee docs: Reduce min-width
This was 450px, which is still quite wide, it also shows up weird in
firefox.

So let's use 150px, which is still basically readable.

[ci skip]
2020-10-04 11:28:22 +02:00
Fabian Homborg
68fb1d9883 CHANGELOG New doc theme
[ci skip]
2020-10-04 11:07:30 +02:00
Fabian Homborg
8c0469245d Adapt styling from fish-site 2020-10-04 11:05:48 +02:00
Fabian Homborg
038b7dacd0 Remove copyright link
We do not have a copyright file, the license is linked in the TOC
2020-10-04 11:05:48 +02:00
Fabian Homborg
c378b11eb4 Remove genindex
It does not work, so we don't want a link to it.
2020-10-04 11:05:48 +02:00
Fabian Homborg
bec23967d5 Find theme via html_theme_path
Seems easier
2020-10-04 11:05:48 +02:00
Fabian Homborg
3a5b0964f0 Use the small lcd version of our logo
Yoinked from fish-site, this looks alright.
2020-10-04 11:05:48 +02:00
Fabian Homborg
04663e0e21 Replace the doc theme with the pydoctheme
Released under the Python Software Foundation License, this one
doesn't look awful (no green top bar, huzzah!).

Lightly forked it to remove the donation footer (we don't take any)
and to change the python references to fish references.

The image is just our favicon, which is a stylized "f" and therefore
not fantastic (are we facebook?), but it's the best I found, and the
thing before had no images at all.

Fixes #6500
(as far as I'm concerned)
2020-10-04 11:05:48 +02:00
Joni Salmi
f845f267bd umount.fish Add long flags and fix long description in completion #6981 2020-10-03 17:16:39 -07:00
ridiculousfish
a6686ca310 Run makewhatis in the background
In the new __fish_apropos, makewhatis is run explicitly to generate the
whatis database. However this can be a little slow. Run it in the
background, after the apropos call completes so as to avoid a weird
race.

This means that descriptions may not be available the first time the
user invokes it, but that's better than appearing to hang for a while.
2020-10-03 17:09:00 -07:00
Folke Lemaitre
a6a0d43c9c Better __fish_describe_command for Macos
override MANPATH used by apropos with local whatis database and update it once a day

get rid of xargs

Created __fish_apropos and fixed __fish_complete_man to use that as well

moved macos apropos comment
2020-10-03 16:18:44 -07:00
ridiculousfish
f9e426813c Do not complain about fcntl(F_SETOWN) failing
On WSL1, fcntl(F_SETOWN) will fail and this would report an error.
Suppress this error message since it is not very interesting.
The effect is to disable real-time universal variable propagation.
2020-10-03 15:54:27 -07:00
Ilan Cosman
067ec6ca97 Synopses examples for vcs services now function as intended 2020-10-02 23:45:38 +02:00
Fabian Homborg
17157b3516 docs: Update example prompt in fish_prompt docs
This used `whoami` and `hostname` and lacked spaces.

[ci skip]
2020-10-02 19:02:10 +02:00
ridiculousfish
558dd6e53d Add sigio-based universal notifier strategy
Introduce a new strategy for notifying other fish processes of universal
variable changes, as a planned replacement for the complex
strategy_named_pipe. The new strategy still uses a named pipe, but instead
of select() on it, it arranges for SIGIO to be delivered when data is
available. If a SIGIO has been seen since the last check, it means the file
needs to be re-read.
2020-10-01 13:19:41 -07:00
ridiculousfish
700fe4f131 Moderize universal variable notifiers
Use some C++11 features.
2020-10-01 13:27:13 -07:00
Johannes Altmanninger
a1fd9e1b85 Fix invalid flags for builtin type
This combination of flags doesn't work anymore, which makes sense.
2020-09-30 21:46:43 +02:00
Fabian Homborg
bbdfe126a7 Flash if history search found nothing
This makes it clearer that we're at the end.

Fixes #7362.
2020-09-30 18:02:22 +02:00
Johannes Altmanninger
6d30a9f9e4 Disable clang-tidy lint about adding noexcept to move constructors
See #7356. We don't use exceptions, so this lint seems useless.
2020-09-28 20:46:56 +02:00
Aurelio Jargas
8d2e4bbef5 Fix string match example
The `?` requires a char, so `foo` cannot match.
2020-09-28 18:49:55 +02:00
Johannes Altmanninger
286ad97cbd Improve string pad examples and add a cross-reference
The old examples were not really showcasing that it's nice for aligning text.
2020-09-28 18:42:02 +02:00
Johannes Altmanninger
3002c88f44 Set fish_emoji_width in test to guard against older wcwidth
See #7340
2020-09-28 18:09:39 +02:00
Fabian Homborg
dfcb4b811c tests: Regex the width tests
Some wcwidths are old.

Belongs to #7340.
2020-09-28 17:48:42 +02:00
Fabian Homborg
d6d3abf59a Introduce $FISH_DEBUG and $FISH_DEBUG_OUTPUT variables
Same as the `--debug` and `--debug-output` options, can be enabled
when the option can't be passed, e.g. in linux shebangs.

Fixes #7359.
2020-09-28 17:46:37 +02:00
David Adam
b1818270f9 CHANGELOG: work on 3.2.0
[ci skip]
2020-09-28 22:48:21 +08:00
ridiculousfish
c89c72f431 Invert sense of expand_flag::no_descriptions
When expanding a string, you may or may not want to generate
descriptions alongside the expanded string. Usually you don't want to
but descriptions were opt out. This commit makes them opt in.
2020-09-27 16:50:40 -07:00
Johannes Altmanninger
f758d39535 string pad: handle padding characters of width > 1
If the padding is not divisible by the char's width without remainder,
we pad the remainder with spaces, so the total width of the output is correct.

Also add completions, changelog entry, adjust documentation, add examples
with emoji and some tests.  Apply some minor style nitpicks and avoid extra
allocations of the input strings.
2020-09-27 21:59:15 +02:00
Johannes Altmanninger
5ae03414d7 Sort string subcommands, and use binary search for lookup
I have no idea if this is better, and did not attempt to measure it, but we
do the same for electric variables which are even fewer.
2020-09-27 21:59:15 +02:00
Johannes Altmanninger
30f821c8f4 Fix example in string length docs
Technically the equivalence would be something like

	string length -q $str
	test -n (string join \n -- $str | string collect)

To handle when str has multiple empty strings;
but quoting is easier to remember and enough for most practical purposes.
2020-09-27 21:59:15 +02:00
Andrew Prokhorenkov
92511b09c4 New command "string pad" to pad text to a given width (#7340)
Pads text to a given width, or the maximum width of all inputs.
2020-09-27 21:59:15 +02:00
Johannes Altmanninger
46746b4b26 completions/git: offer commit ranges for range-diff
A match made in heaven!
2020-09-27 21:59:15 +02:00
ridiculousfish
1390112b46 Suppress linker warnings in Mac debug builds
fish wants to build with -mmacosx-version-min=10.9. This is important
because it ensures that we do not use functions or linker features which
which are not available on 10.9. However this collides with the fact
that fish also prefers to use a pcre2 package installed on the system,
which is typically built for that system.

Mac ld will (rightly) complain when it sees a 10.9-targeted binary
linking a 10.15-targeted dylib. This is an annoying warning that gets
emitted on every build.

We could fix this either having Mac builds prefer the vendored PCRE2
by default, or by having debug builds target the system version. But
we want to continue to default to system PCRE2 and we don't want to risk
losing compatibility with older Mac versions. So we will just suppress
all linker warnings in Mac debug builds.
2020-09-27 11:35:16 -07:00
Johannes Altmanninger
e8859b4ce2 Do not treat newlines special in bigword movements
Improves on #7328.

I believe this is the correct behavior, simply skip all whitespace before
a word. Try with

	./fish -C 'bind \ef forward-bigword; bind \eb backward-bigword; bind \ed kill-bigword; bind \cw backward-kill-bigword'

Also unrelated formatting fixes. I don't think a CI failure on unformatted
code is warranted but I wish it could do that behind the scenes.
2020-09-27 18:04:09 +02:00
Johannes Altmanninger
791d23502f Do not add a space after completing flag with optional argument
For example "grep --color"<TAB> can complete to "grep --color=".  Don't add
a space in this case; we do the same for arguments that end in =.

In GNU-style getopt, equal sign means that the flag has an argument. Without
the = it would not consume the next argument as opposed to Python's argparse.
2020-09-27 17:56:21 +02:00
David Adam
9f1fc6d040 CHANGELOG: work on 3.2.0
[ci skip]
2020-09-27 22:37:18 +08:00
sgrj
ab2cb03189
Consistency-fix for word motions (#7354)
* change word motion test to include start cursor in specification

* add test case for bug

* fix bug
2020-09-27 15:34:34 +02:00
Fabian Homborg
adb1f993a7 Reader: Turn *off* INLCR for external commands
That's how it worked previously, and it makes ctrl-j usable again.

Fixes #7352
2020-09-27 13:54:47 +02:00
Fabian Homborg
0f7e2ca99c Don't put commandline on a new line if prompt is "long"
This was a weird special behavior where we'd put the commandline on a
new line if it wrapped *and* the prompt was > 33% of the screen.

It seems to be more confusing than anything.

Fixes #5118.
2020-09-27 13:12:06 +02:00
Fabian Homborg
689e96263e tests: Add yet another sleep 2020-09-27 09:22:45 +02:00
David Adam
73173dce7a CHANGELOG: work on 3.2.0
[ci skip]
2020-09-27 10:54:15 +08:00
ridiculousfish
e88eb508d0 Rework variable assignments during tab completion
Prior to this change, tab completing with a variable assignment like
`VAR=val cmd<tab>` would parse out and apply VAR=val, then recursively
invoke completions. This caused some awkwardness around the wrap chain -
if a wrapped command had a variable completion we risked infinite
recursion. A secondary problem is that we would run any command
substitutions inside variable assignment, which the user does not expect
to run until pressing enter.

With this change, we explicitly track variable assignments encountered
during tab completion, including both those explicitly given on the
command line and those found during wrap chain walk. We then apply them
while suppressing command substitutions.
2020-09-26 18:39:38 -07:00
ridiculousfish
cc07716dc1 Separate out variable assignments when completing
In preparation for applying variable assignments (VAR=VAL cmd), separate
them out from the command when performing completions. This includes both
those that the user typed, and any that come about through
completion --wraps.
2020-09-26 17:30:25 -07:00
ridiculousfish
3ef83de866 Rename cmd to cmdline in completer_t::perform_for_command
This makes it clear that the commandline contains arguments, etc.
2020-09-26 17:30:13 -07:00
ridiculousfish
757dda43ac Factor custom completion information into custom_arg_data_t
When completing and walking a wrap chain, we pass around a lot of
information. Factor this together into a new struct custom_arg_data_t
which reduces the number of parameters needed.
2020-09-26 17:30:10 -07:00
ridiculousfish
5cadea0173 Migrate the complete_custom transient command line pop to cleanup_t
This ensures that it gets cleaned up even if there is a mid-function
return.
2020-09-26 17:25:02 -07:00
ridiculousfish
45b85d28bb Completion wrap chain visited set to store only wrapped command
The "wrap chain" refers to a sequence of commands which wrap other
commands, for completion purposes. One possibility is that a wrap chain
will produce a combinatorial explosion or even an infinite loop, so there
needs to be logic to prevent that. Part of that logic is encapsulated in a
visited set (wrap_chain_visited_set_t) to prevent exploring the same item
twice.

Prior to this change, we stored pairs (command, wrapped_command). But we
only really need to store the wrapped command. Switch to that.

One consequence is that if a command wraps another command in more than
one way, we won't explore both ways. This seems unlikely in practice.
2020-09-26 17:24:59 -07:00
Fabian Homborg
f708632ca3 tests: Remove test for windows line ending message
This is flaky on launchpad for some reason, and it's really not
important enough to hold it up.

So let's just leave this untested.
2020-09-26 15:19:24 +02:00
Fabian Homborg
caccc0cddb Add more tests for -c arguments 2020-09-26 15:19:24 +02:00
Johannes Altmanninger
879e80859c Refactor: apply some lints
And reformat touched files; my editor just does that.
2020-09-26 14:56:03 +02:00
Johannes Altmanninger
45e7c709f4 Consolidate complete cycle detection and always report error on cycle
Detect recursive calls to builtin complete and the internal completion in
the same place.

In 0a0149cc2 (Prevent infinite recursion when completion wraps variable assignment)
we don't print an error when completing certain aliases like:

	alias vim "A=B vim"

But we also gave no completions.
We could make this case work, but I think that trying to salvage situations
like this one is way too complex. Instead, let the user know by printing an
error. Not sure if the style of the error fits.

We could add some heuristic to alias to not add --wraps in some cyclic cases.
2020-09-26 14:56:03 +02:00