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.
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
```
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.
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.
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.
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.
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.
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.
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.
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.
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]
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]
* 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)
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慡