Commit Graph

17657 Commits

Author SHA1 Message Date
Fabian Boehm
c07136e8d3 docs: Mention fish_cursor_replace
Fixes #9956
2023-08-15 19:11:03 +02:00
Fabian Boehm
1dc65a694d completions/read: Remove long-removed "--mode-name" flag
Disabled in c6093ad782 (in 2.7.0)
2023-08-15 18:34:41 +02:00
Gregory Anders
69ef51f417 Enable PWD reporting for iTerm2 2023-08-14 18:09:12 +02:00
ridiculousfish
d47b2a7e0b Refactor the killring to make it instanced
This improves test isolation.

Also standardize on the name "killring" instead of "kill list" and remove some
dead code.
2023-08-13 13:06:06 -07:00
ridiculousfish
2b25cd1654 Complete the transition of the kill ring and remove kill.cpp
This finishes off the transition of the kill ring from C++ to Rust, and removes
the C++ bits.
2023-08-13 13:06:06 -07:00
Fabian Boehm
995f12219b Use out_is_terminal
This removes some spurious unsafe and some imports.

Note: We don't use it in `test`, because that can be asked to check
arbitrary file descriptors, while this only checks stdout specifically.
2023-08-13 14:17:52 +02:00
Fabian Boehm
5f0df359b8 Remove C++ version of builtin functions
And the C++ reformat_for_screen and event_filter_names as there are no more users.
2023-08-13 14:17:44 +02:00
Fabian Boehm
6489ef5ac0 Rewrite builtin functions in rust 2023-08-13 14:17:44 +02:00
Fabian Boehm
5e78cf8c41 Add io_streams_t::out_is_terminal()
This encapsulates a "is our output going to the terminal" check we do
in a few places - functions, type, set_color, possibly test
2023-08-13 14:17:44 +02:00
Fabian Boehm
b75f901376 Fix reformat_for_screen
This had an infinite loop because it had two checks broken
2023-08-13 14:17:44 +02:00
Fabian Boehm
ee8e790aa7 Fix event::print's header printing
Turns out doing `==` on Enums with values will do a deep comparison,
including the values.

So EventDescription::Signal(SIGTERM) is !=
EventDescription::Signal(SIGWINCH).

That's not what we want here, so this does a bit of a roundabout thing.
2023-08-13 14:17:44 +02:00
Fabian Boehm
4f86f303f5 Make functions for builtin functions public
event filter names, function::set_desc, common::reformat_for_screen

This is the first use for each
2023-08-13 14:17:44 +02:00
99jte
5b136d450f
Include the target of bad redirects in the error (#9947)
Fixes #8877
2023-08-13 14:01:32 +02:00
ridiculousfish
b2ff4d6bc0 Adopt Rust PosixSpawner
This removes the C++ posix_spawner_t, adopting the Rust implementation.
2023-08-12 17:15:21 -07:00
ridiculousfish
245f7db5b3 Port PosixSpawner to Rust
PosixSpawner is our wrapper around posix_spawn.
2023-08-12 16:59:38 -07:00
Roland Fredenhagen
408ab86090
Add iwctl completions (#9932)
* Add iwctl completions

* review-comments

* options
2023-08-10 19:35:27 +02:00
Emily Grace Seville
f9d21cc21d
Add horcrux completion (#9922)
* feat(completions): horcrux

* feat(changelog): mention completion

* fix(completion): condition for -n
2023-08-09 17:30:34 +02:00
Gabriel Górski
21ddfabb8d
Simplify and fix __fish_is_zfs_feature_enabled (#9939)
* Simplify and fix `__fish_is_zfs_feature_enabled`

Previously `__fish_is_zfs_feature_enabled` was doing
`<whitespace>$queried_feature<whitespace>` pattern matching which
was skipping the state part expected in the follow-up checking code.

Passing the dataset/snapshot in a `target` argument is pointless. As
none of the existing code attempts to do this plus it is also a
private function (`__` prefix), rename of the argument and removal
of extra text replacement should not be considered a breaking change.

* Changed the `&& \` into `|| return`

* Run `fish_indent`
2023-08-09 17:28:01 +02:00
Fabian Boehm
27a11ef7fe builtin builtin: Print help if run without an action to do
Fixes #9942
2023-08-09 17:26:07 +02:00
Henrik Hørlück Berg
0844247b43 Prefer os-unix prelude over importing everything separately 2023-08-09 15:00:58 +02:00
Henrik Hørlück Berg
131e249b0c Adopt the builtin prelude 2023-08-09 15:00:58 +02:00
Henrik Hørlück Berg
773bafb7c7 Add a builtin prelude
- Most builtins share a lot of similar imports
2023-08-09 15:00:58 +02:00
Henrik Hørlück Berg
1b018c8bfb Add note to rust devel about the wchar builtin 2023-08-09 15:00:58 +02:00
Henrik Hørlück Berg
fae090ea67 Adopt the wchar prelude 2023-08-09 15:00:58 +02:00
Henrik Hørlück Berg
5d58652394 Add a wchar prelude
- This will hopefully make it easier to always include WExt and ToWString, and
  make using WStr/WString more natural
2023-08-09 15:00:58 +02:00
Johannes Altmanninger
b7f7dcf788 Copy history pager search field to command line on Enter if no match
Closes #9934
2023-08-08 21:53:42 +02:00
Henrik Hørlück Berg
3a484480bf Remove premature optimization
The `impl<T> Hash for &T` hashes the string itself[^1].
It is unclear if that is actually faster than just calling `keyfunc` multiple times (they should all be linear).
For context, Rust by default uses SipHash 1-3 db1b1919ba
An alternative would be to store it as raw pointers aka `*const T`, which have a cheaper hash impl.
That has a more complicated implementation + removes lifetimes.

This commit rather removes the premature optimization.

[^1]: Source: https://doc.rust-lang.org/std/ptr/fn.hash.html
2023-08-07 21:01:11 -07:00
Henrik Hørlück Berg
4a4171c34a Forward some error messages and fix a bug
- The Err-variants will be used by e.g. wildcard, so might as well change it
  now.
- `create_directory` should now not infinitely loop until  it fails with an
  error message that isn't `EAGAIN`
2023-08-07 21:01:11 -07:00
Henrik Hørlück Berg
f4a5de1fbf Port builtins/path to Rust 2023-08-07 21:01:11 -07:00
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