Commit Graph

17476 Commits

Author SHA1 Message Date
ridiculousfish
6d4916a77c Stop using path sort in some path tests
Globs are already sorted, so this should be unnecessary. Remove these and add a
test that we are sorted already.
2023-08-07 19:56:27 -07:00
Fabian Boehm
73d30ac4f8 parse_execution: Remove some useless no_exec checks
These are both clearly behind early returns, there is no need to check it again.

This isn't a case where we're doing logic gymnastics to see that it
can't be run without no_exec() being handled, this is

```c++
if (no_exec()) return;
// ..
// ..
// ..

if (no_exec()) foo;
```
2023-08-07 17:42:47 +02:00
Fabian Boehm
ab6abaa114 Fix path tests on FreeBSD 2023-08-07 17:22:19 +02:00
ridiculousfish
f4132af114 Further improve builtin path tests 2023-08-06 18:51:11 -07:00
ridiculousfish
62ad661a5c Add some more builtin path tests
This plugs some holes in our tests.
2023-08-06 18:16:07 -07:00
ridiculousfish
2d779fb194 Fix additional clippy lint errors
These lint errors appear new with clippy 0.1.72.
2023-08-05 17:29:53 -07:00
ridiculousfish
8771d8f903 Remove some pub(self)s
This fixes a clippy 0.1.72 lint
2023-08-05 15:50:07 -07:00
ridiculousfish
0d3f943f30 Add some additional tests for builtin math
This fills some gaps in our error message test coverage.
2023-08-05 11:54:39 -07:00
David Adam
09ed315159 README: remove Xcode, minor linting
Closes #9924.
2023-08-04 22:28:11 +08:00
Henrik Hørlück Berg
900a048744 Don't segfault if user has an invalid locale
Fixes #9928
2023-08-03 19:55:05 +02:00
Fabian Boehm
ee75b45687 Remove a waccess call when completing executables
We have already run waccess with X_OK. We already *know* the file is
executable.

There is no reason to check again.

Restores some of the speedup from the fast_waccess hack that was
removed to fix #9699.
2023-08-03 19:53:07 +02:00
Fabian Boehm
5de19d2e84 Remove broken &
Fixes the build
2023-08-02 21:21:46 +02:00
Henrik Hørlück Berg
4728eaf642 Don't specify a min macOS version when not needed
Corrosion does not forward the `CMAKE_OSX_DEPLOYMENT_TARGET` to cargo.
As a result we end up building the Rust-libraries for the default target,
which is usually current macOS-version. But CMake links using the set
target, so we link for a version older than we built for.

To properly build for older macOS versions, the env variable
`MACOSX_DEPLOYMENT_TARGET` should instead be set, which cargo,
cmake and friends read by default. This can then lead to
warnings if you have libraries (e.g. PCRE2) built for newer
than our minimum version. Therefore we do not set a min-target
by default.
2023-08-02 22:42:52 +08:00
Henrik Hørlück Berg
55b6d7cd74 Revert "Fix built for newer than linked macOS warning"
This reverts commit 69ed2d1ca7. It was never meant
to be merged.
2023-08-02 22:42:52 +08:00
David Adam
35aa7636eb fds: add make_fd_{,non}blocking implementations in Rust 2023-08-01 22:56:25 +08:00
David Adam
0b291355b2 wutil: add perror implementation that takes an io::Error 2023-08-01 22:56:25 +08:00
Roland Fredenhagen
3d0b66c825 In .editorconfig replace max_line_length: none with off.
According to
https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_length
that is the correct value to disable this property.
2023-07-31 09:18:46 +02:00
AsukaMinato
9a9e133b18
add gcc completion lm lz lrt (#9919)
add some gcc completion options
2023-07-29 10:52:23 +08:00
Henrik Hørlück Berg
2ec36338f2 Very minor leftover codereview var-renaming 2023-07-27 22:00:03 -07:00
Henrik Hørlück Berg
cdc08dbb71 Add back well-backed comment
- The dermination is from commit 7988cff6bd
- See PR https://github.com/fish-shell/fish-shell/pull/9139
2023-07-27 22:00:03 -07:00
Henrik Hørlück Berg
6dd2cd2b20 Fix behaviour in the presence of non-visible width
Padding with an unprintable character is now disallowed, like it was for other
zero-length characters.

`string shorten` now ignores escape sequences and non-printable characters
when calculating the visible width of the ellipsis used (except for `\b`,
which is treated as a width of -1).
Previously `fish_wcswidth` returned a length of -1 when the ellipsis-str
contained any non-printable character, causing the command to poentially
print a larger width than expected.

This also fixes an integer overflows in `string shorten`'s
`max` and `max2`, when the cumulative sum of character widths turned negative
(e.g. with any non-printable characters, or `\b` after the changes above).
The overflow potentially caused strings containing non-printable characters
to be truncated.

This adds test that verify the fixed behaviour.
2023-07-27 22:00:03 -07:00
Henrik Hørlück Berg
20be990fd9 Port builtins/string to Rust
- Add test to verify piped string replace exit code

Ensure fields parsing error messages are the same.

Note: C++ relied upon the value of the parsed value even when `errno` was set,
that is defined behaviour we should not rely on, and cannot easilt be replicated from Rust.
Therefore the Rust version will change the following error behaviour from:

```shell
> string split --fields=a "" abc
string split: Invalid fields value 'a'
> string split --fields=1a "" abc
string split: 1a: invalid integer
```

To:

```shell
> string split --fields=a "" abc
string split: a: invalid integer
> string split --fields=1a "" abc
string split: 1a: invalid integer
```
2023-07-27 22:00:03 -07:00
AsukaMinato
2110b36426 more gcc -O completion
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
2023-07-27 17:44:41 +02:00
Emily Grace Seville
6ce2ffbbb0
Add Krita completions (#9903)
* feat(completions): support Krita

* feat(completions): support summary options for Krita

* feat(completions): support remaining options for Krita

* feat(completions): remove debug instructions

* feat(completions): hide completions for sizes for Krita

* feat(completions): fix Krita

* feat(changelog): mention new completion

* fix(completions): refactor Krita

* fix(completion): reformat

* feat(completion): dynamically generate workspace list

* fix(completion): refactor

* fix(completion): krita

* fix(completions): use printf
2023-07-27 17:43:51 +02:00
Emily Grace Seville
8d3885b9cb
Add Blender completions (#9905) 2023-07-27 17:42:55 +02:00
Pavel savchenko
c56f9e1981 Docs: correct small grammatical error in read.rst 2023-07-26 09:20:49 +02:00
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