Commit Graph

17450 Commits

Author SHA1 Message Date
Fabian Boehm
ed881bcdd8 Make default theme use named colors only
This gives us the biggest chance that these are *visible* in the
terminal, which allows people to choose something nicer.

It changes two colors - the autosuggestion and the pager
description (i.e. the completion descriptions in the pager).

In a bunch of terminals I've tested these are pretty similar - for the
most part brblack for the suggestions is a bit brighter than 555, and
yellow for the descriptions is less blue
than the original.

We could also make the descriptions brblack, but that's for later.

Technically we are a bit naughty in having a few foreground and
background pairs that might not be visible,
but there's nothing we can do if someone makes white invisible on brblack.

Fixes #9913
Fixes #3443
2023-07-25 16:42:24 +02:00
ridiculousfish
ade6650599 Remove FunctionPropertiesRef type alias
Per code review, this type alias was confusing.
2023-07-23 17:18:36 -07:00
ridiculousfish
e24a16bd31 function: make inherit_vars a boxed slice instead of a hash map
Empty hash maps muck around with TLS. Per code review, use a boxed slice
of a tuple instead. This has the nice benefit of printing inherited vars
in sorted order.
2023-07-23 17:18:36 -07:00
ridiculousfish
a672edc0d5 Adopt the new function store and rewrite builtin_function
This adopts the new function store, replacing the C++ version.

It also reimplements builtin_function in Rust, as these was too coupled to
the function store to handle in a separate commit.
2023-07-23 17:18:36 -07:00
ridiculousfish
076f317c31 Implement (but do not yet adopt) fish function store in Rust
This reimplements the function module in Rust. The function module stores the
global set of fish functions, and provides information about them.
2023-07-23 17:18:36 -07:00
EmilySeville7cfg
3fde15fd9a feat(changelog): explain changes 2023-07-23 15:09:35 -07:00
EmilySeville7cfg
2bc605625e feat(completions): gimp support 2023-07-23 15:09:35 -07:00
Fabian Boehm
5f26c56ed5 completions/pactl: Fix matching objects
This didn't work for something like `pactl set-card-profile foo
<TAB>`,
because it didn't allow for the card name, as it would just print the
index again and again.
2023-07-19 18:13:40 +02:00
Fabian Boehm
2a16e3513e Issue template: Unset XDG_CONFIG_HOME
Fixes #9898
2023-07-17 18:55:06 +02:00
Henrik Hørlück Berg
6325b3662d Fix #9899 integer overflow in string repeat
We could end up overflowing if we print out something that's a multiple of the
chunk size, which would then finish printing in the chunk-printing, but not
break out early.
2023-07-17 15:41:08 +02:00
ridiculousfish
2a13a30807 Clean up DirIter
DirIter had a serious bug where it would crash on an invalid path. Make it more
robust and rationalize its error handling. Move it into its own module and add
tests.
2023-07-16 12:05:29 -07:00
ridiculousfish
f5e5896c70 Remove the EventDescription wrapper type
Prior to this change, we had a silly wrapper type EventDescription which wrapped
EventType, which actually described the event.

Remove this wrapper and rename EventType to EventDescription (since it describes
more than just the type of event).
2023-07-15 11:59:08 -07:00
ridiculousfish
ecfabf4db8 argparse: Use a named constant for RETURN_IN_ORDER returns
The RETURN_IN_ORDER argparse mode (enabled via leading '-') causes non-options
(i.e. positionals) to be returned intermixed with options in the original order,
instead of being permuted to the end. Such positionals are identified via the
option sentinel of char code 1. Use a real named constant for this return,
rather than weird stuff like '\u{1}'
2023-07-15 11:35:13 -07:00
Fabian Boehm
bfd97adbda completions/rclone: Add version parsing
This had a weird, unnecessary and terrible backwards-incompatibility
in how you get the completions out.

I do not like it but I am in a good enough mood to work around it.

See #9878.
2023-07-15 14:25:41 +02:00
Fabian Boehm
3d7ad4d3f1 README: Update dependencies for riir
Fixes #9893
2023-07-15 10:56:28 +02:00
Fabian Boehm
54fa1ad6ec Revert "Try to move rust CI back to 1.70"
Should *hopefully* be fixed by deleting the cache at https://github.com/fish-shell/fish-shell/actions/caches.

This reverts commit 5c29ff52fb.
2023-07-14 21:36:43 +02:00
Fabian Boehm
5c29ff52fb Try to move rust CI back to 1.70
1.71 seems to have weird issues on Github Actions and that makes the
tests fail for no good reason

(gosh dangit YAML)
2023-07-14 21:11:15 +02:00
Fabian Boehm
6823f5e337 wildcard: Remove useless access() call for trailing slash
This confirmed that a file existed via access(file, F_OK).

But we already *know* that it does because this is the expansion for
the "trailing slash" - by definition all wildcard components up to
here have already been checked.

And it's not checking for directoryness either because it does F_OK.

This will remove one `access()` per result, which will cut the number
of syscalls needed for a glob that ends in a "/" in half.

This brings us on-par with e.g. `ls` (which uses statx while we use
newfstatat, but that should have about the same results)

Fixes #9891.
2023-07-14 20:20:34 +02:00
David Adam
861da91bf1 drop unused functions and configure checks
Remove the following C++ functions/methods, which have no callers:

fallback.cpp:
- wcstod_l

proc.cpp:
- job_t::get_processes

wutil.cpp:
- fish_wcstoll
- fish_wcstoull

Also drop unused configure checks/defines:
- HAVE_WCSTOD_L
- HAVE_USELOCALE
2023-07-14 20:48:56 +08:00
David Adam
44cf0e5043 add comment regarding importance of unused describe_char function 2023-07-14 20:48:56 +08:00
David Adam
0037e6e98d drop ported C++ functions
Remove the following C++ functions/methods, which have all been ported to Rust and no longer have any callers in C++:
common.cpp:
- assert_is_locked/ASSERT_IS_LOCKED

path.cpp:
- path_make_canonical

wutil.cpp:
- wreadlink
- fish_iswgraph
- file_id_t::older_than
2023-07-14 20:48:56 +08:00
Fabian Boehm
493cbeb84c completions/git: Trim with the regex
This gives us another few percent.

It's not *technically* the same because `trim` would remove a run of
quotes, but that would be wrong anyway.
2023-07-13 18:05:55 +02:00
Fabian Boehm
dd26611c0f completions/git: Move some variables to the v1 path
No longer used elsewhere
2023-07-13 16:51:16 +02:00
Fabian Boehm
7f76f75966 completions/git: Add fast path for untracked files
It's super easy to get a lot of these and they'll otherwise slow down
the completions a lot.

This makes `git add <TAB>` ~5-6x faster with about 4000 untracked
files (a copy of the fish build directory). It goes from 1.5 seconds to
250ms.

This is just for the git >= 2.11 path, but the other one would require
more checking and since git 2.11 is almost 7 years old now that's not
worth it.
2023-07-13 16:46:22 +02:00
Fabian Boehm
1f1975689e completions/git: Don't check commandline so much
This just caches some checks, speeding up `git add ` completions by
~33% with 4000 matching files.
2023-07-13 16:31:33 +02:00
Fabian Boehm
a6c36a014c Return a falsey status if the last -c command has a parse error
This makes `fish -c begin` fail with a status of 127 - it already
printed a syntax error so that was weird. (127 was the status for
syntax errors when piping to fish, so we stay consistent with that)

We allow multiple `-c` commands, and this will return the regular
status if the last `-c` succeeded.

This is fundamentally an extremely weird situation but this is the
simple targeted fix - we did nothing, unsuccessfully, so we should
fail.

Things to consider in future:

1. Return something better than 127 - that's the status for "unknown
command"!
2. Fail after a `-c` failed, potentially even checking all of them
before executing the first?

Fixes #9888
2023-07-12 18:06:34 +02:00
Henrik Hørlück Berg
63b23713f2 Support thread-safe feature-flag-dependant tests
This also allows scoped feature tests that makes testing feature flags thread-safe.
As in you can guarantee that the test actually has the correct feature flag
value, regardless of which other tests are running in parallell.
2023-07-11 12:05:38 -07:00
Henrik Hørlück Berg
f1cd43d58b Disallow using set outside of tests, minor fixes 2023-07-11 12:05:38 -07:00
Henrik Hørlück Berg
726819e8ee Clean up feature flags API
This also cleans up and removes unnecessary usage of FFI-oriented `feature_metadata_t`,
which is only used from Rust code after `builtins/status` was ported.
2023-07-11 12:05:38 -07:00
Fabian Boehm
2b0e3ba3b8 __fish_print_hostnames: Fix regex
This used `]` when it should have been `}`, which made the regex nonsensical

Broken since 94c12d84e2 in 2016
2023-07-11 20:50:56 +02:00
Fabian Boehm
1a11cee559 functions/cd: Optimize check for too many args
This ran two `test`s a `count` and one `echo`, which is a bit wasteful.

So instead, for the common case where you pass one argument, this will
run one `set -q`.

This can save off ~160 microseconds for each ordinary `cd`, which
speeds it up by a factor of ~2 (so 1000 runs of cd might take 260ms
instead of 550ms).

Ideally the cd function would just be incorporated into the builtin,
but that's a bigger change.
2023-07-11 18:01:29 +02:00
elyashiv
3fbff14e9b [tests] added test for escaped job summary 2023-07-10 18:38:26 +02:00
elyashiv
4a2c7e38d0 [jobs.cpp] added const to escaped cmd string 2023-07-10 18:38:26 +02:00
elyashiv
0dfef25b4c [CHANGELOG.rst] added line about escaping jobs 2023-07-10 18:38:26 +02:00
elyashiv
4ea867bc55 [jobs.cpp] add escaping for job comamnd 2023-07-10 18:38:26 +02:00
Adam J. Stewart
72de1dc201 Docs: fix code block 2023-07-10 18:31:46 +02:00
ridiculousfish
57afaf7fb2 Restore the behavior of remembering the CWD fd in the parser
This will be important for concurrent execution, because different parsers will
have different working directories.
2023-07-10 21:30:37 +08:00
David Adam
289fbecaa9 Rewrite cd builtin in Rust
Note this is slightly incomplete - the FD is not moved into the parser, and so
will be freed at the end of each directory change. The FD saved in the parser is
never actually used in existing code, so this doesn't break anything, but will
need to be corrected once the parser is ported.
2023-07-10 21:30:37 +08:00
Adam J. Stewart
e31c0ebb05 Fix grammar in completion docs 2023-07-09 14:11:01 +08:00
ridiculousfish
c1e1efd747 Pull an allocation out of the string escape test inner loop 2023-07-08 11:26:32 -07:00
ridiculousfish
98d88e06ff Use setlocale() in the test_convert test
This "fixes" (or at least hides) the intermittent test_convert failures,
as we no longer race with other setlocale calls.
2023-07-08 11:22:47 -07:00
ridiculousfish
a99fa201b6 Make escape_test an ordinary function
This did not need to be a macro.
2023-07-08 11:19:44 -07:00
Henrik Hørlück Berg
7b0f9fd5f8 Double the speed of cargo test, actually run test
- Parallelize the slow tests if possible.
- `test_convert_ascii` was missing a `#[test]` annotation
2023-07-08 11:05:55 -07:00
Henrik Hørlück Berg
47f1dbe56c Make test_convert seedable, but generate the seed 2023-07-08 11:05:55 -07:00
pd
ac2810e9ef Fix rclone autocompletion script sourcing issue in fish shell 2023-07-07 21:34:12 +02:00
Fabian Boehm
1a52f79c24 docs/test: More on THE PROBLEM 2023-07-06 18:39:42 +02:00
may
e3e7ab77ad add stash completions to git show and git diff 2023-07-05 10:53:17 +08:00
David Adam
87307775fc fds: add comment on O_CLOEXEC fallback being dropped 2023-07-05 10:30:27 +08:00
ridiculousfish
bee422fea2 Use a faster, deterministic RNG in the string escape tests
This shaves about 9 seconds off of the runtime, and makes the test
deterministic.

We do not touch the test_convert test because there is a known failure and we
need to track it down before making it deterministic.
2023-07-04 13:27:53 -07:00
ridiculousfish
0bfe83ce88 Replace write! calls with explicit hex formatting
Rather than relying Rust's formatting, just compute the hex chars directly.

This shaves about 6 seconds off of the test runtime.
2023-07-04 13:27:53 -07:00