Commit Graph

14784 Commits

Author SHA1 Message Date
Fabian Homborg
78e87fe881 Add "None" theme
This basically disables syntax highlighting. That doesn't mean we use
absolutely no colors - the search match, suggestion, selection and the
pager have coloring, but only reverse or brblack.

The idea is that this disables anything that tells you about
the *syntax*, but it still tells you about the state of the
commandline. If we didn't highlight the selection it would be entirely
invisible, and if we didn't highlight the suggestion you would have no
idea where it begins.

So this basically brings colors on-par with bash, where the search
match is colored (in reverse) and suggestions aren't a thing.

An alternative is to add a $fish_highlighting_enabled variable like
the one for suggestions. That's still possible, but would require some
internal changes to avoid coloring some things with $fish_color_normal
and other things with the normal terminal color.

One thing this also does not do is set the git prompt colors. These
are currently disallowed from being set in theme files because they
start with `__fish` instead of just `fish`. We should probably rename
them.
2021-11-02 21:40:56 +01:00
Fabian Homborg
86b8cc2097 Allow turning off autosuggestions
This adds a variable, $fish_autosuggestion_enabled.

When set to 0, it will turn off autosuggestions/highlighting.
Setting it to anything else will enable it (which also
means this remains enabled by default).
2021-11-02 21:40:56 +01:00
ridiculousfish
d81f817f70 Correct a dropped lock
When iterating the event handler list, we inadverently dropped a lock
because of how range-based for loops work. Hold the lock outside of the
loop.
2021-11-02 12:46:32 -07:00
Fabian Homborg
fcb74f236a Lock enhancements and RFCs again
The point here is to let issues be *done*, and have any *new*
discussions happen in *new* issues so you can decouple the context.

This revert pending further discussion.
2021-11-02 18:15:30 +01:00
Aaron Gyes
e53c284753
Update lockthreads.yml
exclude RFCs, enhancement requests, have it run weekly.
2021-11-02 09:43:47 -07:00
ridiculousfish
73ea7d257e Remove reader_set_buffer
It was unused.
2021-11-01 11:20:28 -07:00
Johannes Altmanninger
c94dec5d0e Fix assertion error trying to highlight cmdsubs inside unbalanced quotes
I initially put this logic + assertion in another function, where we
always get balanced quotes. Not for highlighting.
2021-10-31 14:28:54 +01:00
Johannes Altmanninger
db377385f6 Fix copy paste error 2021-10-31 14:28:54 +01:00
Kevin F. Konrad
788692f1e5
add istioctl completions (#8343)
This program uses the Cobra framework for argument parsing and completion generation.
Just source the completions supplied by upstream.
This works around "go install" not being able to install completions files (only binaries).
2021-10-31 13:10:11 +01:00
Aaron Gyes
8ab05a4036 mark some functions static 2021-10-31 03:51:38 -07:00
Aaron Gyes
70186f2abb don't use size_t for a loop counter that is decremented 2021-10-31 03:51:38 -07:00
Johannes Altmanninger
e40eba3585 Treat text following quoted command substitution as quoted
Commit ec3d3a481 (Support "$(cmd)" command substitution without line
splitting, 2021-07-02) started treating an input string like
"a$()b" as if it were "a"$()"b". Yet, we do not actually insert the
virtual quotes. Instead we just adapted the definition of when quotes
are closed - hence the changes to quote_end().

parse_util_locate_cmdsubst_range() is aware
of the changes to quote_end() but some of its
callers like parse_util_detect_errors_in_argument() and
highlighter_t::color_as_argument() are not.  They split strings at
command substitution boundaries without handling the special quoting
rules. (Only the expansion logic did it right.)

Fix this by handling the special quoting rules inside
parse_util_locate_cmdsubst_range(). This is a bit hacky since it
makes it harder for callers to process some substrings in between
command substitutions, but that's okay because current callers only
care about what's inside the command substitutions.

Fixes #8394
2021-10-30 18:02:10 +02:00
ridiculousfish
e08b71592e pexpect_helper to unconditionally output to the tty
With the new test runner, pexpect_helper no longer sees a tty so wasn't
outputting the buffer. Just always do it.
2021-10-29 20:45:42 -07:00
ridiculousfish
f373e6e923 Reformat pexpect_helper.py with black 2021-10-29 20:42:59 -07:00
Fabian Homborg
4118bda21c docs: Go over the FAQ again
Mention more fish_config CLI, `$()`, do some rewording, ...
2021-10-29 17:14:53 +02:00
Fabian Homborg
a4983af94d docs: Fix section level
Using "=====" makes it an entry in the toc
2021-10-29 17:01:48 +02:00
Fabian Homborg
5c6c405b9e Cache if tracing is enabled
Like the comment said: That var lookup was kind of expensive.

So we simply use variable dispatch like we do for countless other things.
2021-10-28 19:39:30 +02:00
ridiculousfish
e89bd95d58 Mild refactoring of wait handles 2021-10-28 10:37:43 -07:00
ridiculousfish
b9a95a48b4 Test that --on-job-exit functions run even if the job has already exited
If you define a function that you want to be called after a job has
exited, it should run immediately if that job has already exited.
2021-10-28 10:02:48 -07:00
Fabian Homborg
357f49c781 Revert "Use unescape_string_in_place"
This reverts commit 2ef8a9c1af.

This doesn't work everywhere, not sure why.
2021-10-28 18:09:25 +02:00
Fabian Homborg
292c9d5381 Force uselocale if glibc is in use
For some reason on a current glibc 2.33, the configure check fails.
The man page says we'd have to define XOPEN_SOURCE>=700, but I don't
want to do that since it changes a bunch of other things, and it
didn't work in my tests.

So we just force it, since we know it works (since glibc 2.3).

This is a performance difference of ~20% for printf, so it's a
reasonably big deal.
2021-10-28 17:54:35 +02:00
Fabian Homborg
2ef8a9c1af Use unescape_string_in_place
We already get a copy, so we might as well just use it.
2021-10-28 17:32:52 +02:00
Fabian Homborg
8428247f31 docs: Split up the variable docs some more
(also remove some broken or incorrect footnotes)
2021-10-28 16:48:08 +02:00
Fabian Homborg
387904928b docs: Add more on wordsplitting 2021-10-28 16:42:19 +02:00
Fabian Homborg
ae3d5af1ab docs: Correct an example 2021-10-28 16:35:21 +02:00
Fabian Homborg
c3e8f5bc02 CHANGELOG 2021-10-28 16:32:58 +02:00
Fabian Homborg
31d6abb177 Don't fire variable set event before entering a for-loop
Since #4376, for-loops would set the loop variable outside, so it
stays valid.

They did this by doing the equivalent of

```fish
set -l foo $foo
for foo in 1 2 3
```

And that first imaginary `set -l` would also fire a set-event.

Since there's no use for it and the variable isn't actually set, we
remove it.

Fixes #8384.
2021-10-28 16:32:58 +02:00
exploide
1db25c9b31 updated systemd-analyze compltions for systemd 248 2021-10-28 16:12:31 +02:00
Aaron Gyes
575decc35b also not a thread id: nullptr 2021-10-28 02:14:29 -07:00
Aaron Gyes
362319d25f Cleanup on aisle haphazard-everywhere 2021-10-28 01:47:49 -07:00
Fabian Homborg
75d252dadc
CHANGELOG: Move code block where it belongs 2021-10-28 09:10:12 +02:00
ridiculousfish
3848a68e5c Fix a misspeeling 2021-10-27 14:16:32 -07:00
Fabian Homborg
bffb49b38a Explicitly mention function variables don't go out of scope
Fixes #8385.
2021-10-27 16:55:11 +02:00
Fabian Homborg
6941c94c4a
cd: Set var via the string
This was meant to trigger the wcstring_list_t overload by constructing one with `{norm_dir}`. Older gcc can't figure out what to do.

So instead we use the wcstring overload for now.
2021-10-27 10:20:14 +02:00
Aaron Gyes
91a048596b sphinx: enable proper quotes with the smartquotes module
turn off the option for em-dashes.
2021-10-26 10:46:06 -07:00
Fabian Homborg
2b8fe280e0 tests: Switch emoji used
widechar_width no longer classifies U+1F41F as widened-in-9, so the
width no longer changes.

Since we're interested in testing the change here, we need a different
emoji.

Just use 🥁, which was introduced in 9 as wide, and therefore widened
in 9.
2021-10-26 18:30:43 +02:00
Fabian Homborg
f1fe6a5e94 Update widechar_width to Unicode 14
Generated with f438dbf6c4648ec94e154d2e475a3052370ea218
2021-10-26 18:26:25 +02:00
Fabian Homborg
973739e329 Move CHECKS in loop-test to where they are matched 2021-10-26 17:38:40 +02:00
Fabian Homborg
76f3564e2a Remove now unused out_events parameter 2021-10-26 17:38:40 +02:00
Fabian Homborg
0c3c3eaa99 Reuse the variable event for for-loops
This used to construct a vector, which was then passed down and filled
with a new event_t each go around the loop. That's useless - we fire
one event here, and it's simply the variable event.

This reduces the overhead of a for-loop by ~10%:

```fish
for i in (seq 100000)
    true
end
```

runs in about 90% of the time now.
2021-10-26 17:38:35 +02:00
Fabian Homborg
452675d458 Use set_vars_and_fire where possible
This just did the same thing manually.
2021-10-26 17:33:36 +02:00
Fabian Homborg
da201ee8ac Let parser::set_var_and_fire fire the event directly
The vector here gives us *nothing*
2021-10-26 17:33:27 +02:00
Fabian Homborg
d9f094db1a Check if the for variable is invalid before trying to set it 2021-10-26 16:59:03 +02:00
ridiculousfish
e84dad5432 Rationalize null handling in disown_job
disown_job had some extraneous null checks that could not happen in
practice. Simplify this code.
2021-10-25 16:13:00 -07:00
ridiculousfish
ec244c3975 Add tests for dynamically invoked break and continue 2021-10-25 12:43:30 -07:00
ridiculousfish
cb79548c49 Revert "break/continue: Stop checking if it's in a loop again"
This reverts commit 61cd05efb0.

It is true that we detect break and continue errors statically, but they can
still be invoked dynamically, example:

    set sneaky break
    $sneaky # dynamically breaks from the loop

or just `eval break`.

A followup commit will add tests for this.
2021-10-25 12:42:53 -07:00
Fabian Homborg
61cd05efb0 break/continue: Stop checking if it's in a loop again
This is already checked in the parse_util_detect_errors (and might
actually be done in the ast - that's where we check "end")
2021-10-25 18:57:10 +02:00
Fabian Homborg
c444ee2e6a benchmarks: Add globbing 2021-10-25 18:42:18 +02:00
Fabian Homborg
18bb5f1f7e builtin_count: Remove superfluous L'' prefix
(not sure if this broke anything anywhere, but since we're comparing
an actual char* we should use '' without the L)
2021-10-25 18:40:43 +02:00
ridiculousfish
a6a1879481 Remove reader_get_history
It was unused.
2021-10-24 14:17:33 -07:00