Commit Graph

12943 Commits

Author SHA1 Message Date
Charles Gould
5e5b9d75e6 docs: Fix background color for interactive examples
For the few weird code blocks where default highlighting does not work,
we must add the 'highlight' class manually to get matching backgrounds.
This reuses the background color defined in pygments.css.
2020-09-04 19:46:38 +02:00
V
fc13dd362c
Colourise diff(1) output, if supported (#7308) 2020-09-04 18:43:09 +02:00
Fabian Homborg
4817f97823 tests: Print some more info in the job_summary test for debugging
This one fails a bunch on CI and I have no idea why.
2020-09-04 17:53:17 +02:00
Fabian Homborg
04562300e8 Pexpect: Return the match object instead of the result
The result is just the *index* of the pattern that matched. But since
we never pass a *list* it's just always 0.

spawn.match is the MatchObject that produced the match, so it can be
used to post-process the matched output, e.g.

```python
m = expect_re('\d+')
m.group() # is now the matched number
```
2020-09-04 17:53:17 +02:00
David Adam
8f5a84cdc7 CHANGELOG: work on 3.2.0
[ci skip]
2020-09-04 23:16:39 +08:00
Fabian Homborg
55f1cc56da Remove errant fish_wcwidth call
This was added in c9bcb52fe9 for no discernable reason.
2020-09-04 17:12:22 +02:00
Fabian Homborg
1041e59c5b fixup! Do actually use the correct command
Sorry!
2020-09-04 16:59:08 +02:00
Fabian Homborg
0ae37ac83a Add alias completions
Fixes #7305
2020-09-04 16:58:41 +02:00
Fabian Homborg
bfb5b28d0f Let command, jobs and type take --query instead of --quiet
Now command, jobs, type, abbr, builtin, functions and set take `-q` to
query for existence, but the long option is inconsistent.

The first three use `--quiet`, the latter use `--query`. Add `--query`
to the first three, but keep `--quiet` around.

Fixes #7276.
2020-09-04 16:55:09 +02:00
Fabian Homborg
6ca2dbecfb Remove duplicated test
Fixes #7307.
2020-09-04 16:30:13 +02:00
Fabian Homborg
3fcf4e1b20 tests: Shorten a sleep
This waited for a full second just to call `wait`.

Instead let's use 300ms, saving a full 700ms per test run.
2020-09-04 16:29:53 +02:00
Mahmoud Al-Qudsi
91b2edd51d [apt] Add --no-install-recommends
[ci skip]
2020-09-03 21:47:21 -05:00
Mahmoud Al-Qudsi
326fd8d750 [cargo] Add dynamic --package completions
[ci skip]
2020-09-03 13:41:37 -05:00
ridiculousfish
3062994645 Implement cancel groups
This concerns how "internal job groups" know to stop executing when an
external command receives a "cancel signal" (SIGINT or SIGQUIT). For
example:

    while true
        sleep 1
    end

The intent is that if any 'sleep' exits from a cancel signal, then so would
the while loop. This is why you can hit control-C to end the loop even
if the SIGINT is delivered to sleep and not fish.

Here the 'while' loop is considered an "internal job group" (no separate
pgid, bash would not fork) while each 'sleep' is a separate external
command with its own job group, pgroup, etc. Prior to this change, after
running each 'sleep', parse_execution_context_t would check to see if its
exit status was a cancel signal, and if so, stash it into an int that the
cancel checker would check. But this became unwieldy: now there were three
sources of cancellation signals (that int, the job group, and fish itself).

Introduce the notion of a "cancellation group" which is a set of job
groups that should cancel together. Even though the while loop and sleep
are in different job groups, they are in the same cancellation group. When
any job gets a SIGINT or SIGQUIT, it marks that signal in its cancellation
group, which prevents running new jobs in that group.

This reduces the number of signals to check from 3 to 2; eventually we can
teach cancellation groups how to check fish's own signals and then it will
just be 1.
2020-09-03 11:01:27 -07:00
ridiculousfish
760b6e76cc Rename populate_group_for_job to resolve_group_for_job
Factor it to allows the function to not modify the job.
2020-09-03 10:50:17 -07:00
ridiculousfish
6c4d6dc4a9 Make the 'time' keyword a fixed property of a job.
The 'time' prefix may come about either because the job itself is marked
with time, or because of the "inside out" weirdness of 'not time...'.
Factor this logic together and precompute it for a job.
2020-09-02 15:06:17 -07:00
Akatsuki
4f0f5daea9 go.fish: add some missing options
also fix long descriptions #6981
2020-09-02 20:58:29 +02:00
Fabian Homborg
b521ca4875 Always check for fish_right_prompt's existence
This would only check for fish_right_prompt at startup, so if one
wasn't defined then it would never accept one.

The "config" here is just the *name* of the function (which we never
change, so it wouldn't really be necessary, but whatever).

The one exception is the breakpoint, in those we don't run the right
prompt.

Fixes #7302.
2020-09-02 17:51:21 +02:00
Fabian Homborg
4d22ebf49c Remove duplicated line
This was duplicated on accident, and given that it runs outside of the
"if (cur_term != null)" block and accessed max_colors it could cause issues.
2020-09-02 17:37:32 +02:00
Shun Sakai
244feee692
Add completions for some missing GLib's tools (#7300) 2020-09-01 05:15:23 +02:00
Fabian Homborg
ee84223138 Webconfig: Run prompts one at a time if necessary
Termux doesn't support sem_open, which means python doesn't support
multiprocessing.

So we have to resort to brute force.

Fixes #7298.
2020-08-31 16:50:07 +02:00
Fabian Homborg
be3a7c03ba Move truecolor detection to C++
This allows us to send proper debug messages via FLOG, and it removes
more things from share/config.fish.

Note that the logic differs in some subtle ways. For instance it will
now obey $COLORTERM, so if that isn't "truecolor" or "24bit" it will
deactivate truecolor.
2020-08-31 16:49:57 +02:00
Mahmoud Al-Qudsi
c1cb462854 [ffmpeg] Complete some popular codec-specific options 2020-08-30 22:23:25 -05:00
Mahmoud Al-Qudsi
010db9e7be [ffmpeg] Complete filter graphs
Dynamically generate a list of supported filters and transmogrify the
typed out filter graph into a fish completion.

[ci skip]
2020-08-30 22:23:25 -05:00
Mahmoud Al-Qudsi
3d5e1a061c [ffmpeg] Add enumeration of pixel formats
[ci skip]
2020-08-30 22:23:25 -05:00
Mahmoud Al-Qudsi
280e99467d [ffmpeg] Enumerate codecs for numbered streams
* This adds support for enumerating codecs after, e.g., -c✌️0
* (Also adds support for indeterminate codecs without a/s/v specified)

[ci skip]
2020-08-30 22:23:25 -05:00
ridiculousfish
30d0315b60 Add a test that fish_exit handlers run on receipt of SIGHUP 2020-08-30 15:09:34 -07:00
ridiculousfish
0379f21870 Correctly cancel on receipt of SIGHUP
When we receive SIGHUP, stop executing normal fish script (but allow
exit handlers to run).
2020-08-30 15:09:34 -07:00
ridiculousfish
0b075fce88 Factor the exit state to make exit handlers more explicit
This adds a new type 'exit_state_t' which encapsulates where fish is in
the process of exiting. This makes it explicit when fish wants to cancel
"ordinary" fish script but still run exit handlers.

There should be no user-visible behavior change here; this is just
refactoring in preparation for the next commit.
2020-08-30 15:09:31 -07:00
Mahmoud Al-Qudsi
0d3f4db33a [cargo] Use filesystem for --example completions
`cargo run --example` no longer lists examples and never listed examples
that were not built.
2020-08-29 17:06:33 -05:00
Johannes Altmanninger
cf075b4179 Teach up-line to cross empty lines
The line offset of a trailing newline on the commandline was computed incorrectly.
As a result, up-arrow did not work for a commandline like the one inserted by:

	commandline -i echo '' ''

Note this and the previous commit in the changelog.
2020-08-29 12:02:18 +02:00
Johannes Altmanninger
ac60522373 Stop history searches with no results to allow up-or-search to move the cursor
Enter a multiline commandline, for example using

	commandline -i echo echo

And press down-arrow. This will start a new history search which fails.
Then press up-arrow. I expect the cursor to move up, however, because we
are still in history search mode, up-or-search will search instead of moving
the cursor. Correct that by stopping history searches that don't have any results.
2020-08-29 12:02:18 +02:00
Johannes Altmanninger
a20721a278 Address some warnings from clangd 2020-08-29 12:02:18 +02:00
Fabian Homborg
021d4157ca Fix hybrid binding instructions
This needs to have the vi-bindings take precedence, so they need to be
executed *last*.

It just needs to tell them that they shouldn't erase all the bindings.

[ci skip]
2020-08-28 20:50:24 +02:00
Akatsuki
f88d7dd312 btrfs.fish: fix long descriptions 2020-08-28 20:10:12 +02:00
ridiculousfish
b166baf7d6 Fix a warning about ambiguous && and || in pager 2020-08-27 14:14:05 -07:00
Johannes Altmanninger
09f189870e Trigger prompt repaint after printing parser error or background job warning
See #7289
2020-08-27 21:18:26 +02:00
Johannes Altmanninger
c4f8c95c52 CHANGELOG: clarify that tau = 2 * pi
I actually forgot!
2020-08-27 21:18:02 +02:00
Fabian Homborg
6a21a2ce16 Prompts: Don't color space before pipestatus
These passed " [" to __fish_print_pipestatus as the left brace.

If the color contained a background, that would also color the space
in, leading to a weird unbalanced space before and none after.

Instead, prepend the whitespace when printing later.

[ci skip]
2020-08-27 18:41:38 +02:00
Fabian Homborg
bc715c6eb4 docs: Reword some of the Special Variables section
[ci skip]
2020-08-27 17:07:23 +02:00
Fabian Homborg
f88c3389da fish_prompt: Don't do work outside of the function
That just makes it annoying to use `funced`.

Also sync the classic_vcs prompt again.
2020-08-27 17:07:23 +02:00
Fabian Homborg
d00e0ee64b CHANGELOG: Move things out of "Notable" section
As much as I love the new debug categories, they're not front page
material.

[ci skip]
2020-08-27 17:07:23 +02:00
David Adam
c15a4712d0 CHANGELOG: work on 3.2.0
[ci skip]
2020-08-27 22:39:48 +08:00
Johannes Altmanninger
b25b291d38 Refactor: inline clear_pager() 2020-08-26 22:45:05 +02:00
Johannes Altmanninger
9000a3b2fa Redraw pager after it is cleared
Have the new is_repaint_needed() take care of updating the page rendering,
this way we trigger the expected repaints.

Fixes #7289
2020-08-26 22:44:53 +02:00
chref
81d87d1c7f
fix Subversion prompt (#7278)
* fix Subversion prompt

- after switching to "string match", some SVN status symbols need
  proper escaping
- the __fish_svn_prompt_flag_names list was missing
  "versioned_obstructed" and was therefore not in line with
  the symbols from __fish_svn_prompt_chars
- when checking for individual SVN status symbols, use
  "string match -e" to handle the case where multiple different
  symbols appear in one status column
- use "sort -u" before merging all symbols from a column into
  one line

Fixes #6715

* use regex for SVN status matching

Using regex matching will prevent different match behaviour
depending on qmark-noglob feature.
Also, counting the resulting matches is unnecessary.

* use list instead of string for SVN status

Make $column_status a list be not removing newlines from SVN status
output. This makes checking for the individual status types within
a column easier because it doesn't require regex matching.

* added quotes for string length test (-n)
2020-08-26 18:31:23 +02:00
Aurelio Jargas
0304135d2b
docs: Use \ instead of \\ in examples (#7286)
Instead of informing the bell character (hex 07), the example was using
an escaped \ followed by x07.

    $ echo \\x07
    \x07
    $ echo \x07

    $ echo \x07 | od -a
    0000000 bel  nl
    0000002
    $

* docs: Use \u instead of \\u

Instead of informing the Unicode character 慡, this example was using an
escaped \ followed by u6161.

    $ echo \\u6161
    \u6161
    $ echo \u6161
    慡

Before:

    $ string escape --style=var 'a1 b2'\\u6161 | string unescape --style=var
    a1 b2\u6161

Now:

    $ string escape --style=var 'a1 b2'\u6161 | string unescape --style=var
    a1 b2慡
2020-08-26 18:29:03 +02:00
Fabian Homborg
10aa91250d CHANGELOG math bitwise functions and tau 2020-08-26 17:58:25 +02:00
Fabian Homborg
5eb4de4285 math: Implement tau 2020-08-26 17:48:58 +02:00
Fabian Homborg
f14a1d3a27 math: Document hex numbers 2020-08-26 17:48:58 +02:00