Commit Graph

602 Commits

Author SHA1 Message Date
Fabian Boehm
06de374ffd Log original exit code used when a builtin returns a negative exit code
Port of b91723dab6
2024-01-05 16:52:18 +01:00
Fabian Boehm
3213883510 Add error messages where the errors are generated
This removes an awkward hack from ParseError::describe_with_prefix,
where it added errors for two error codes.

andor_in_pipeline was already there, so we just need bare_variable_assignment.
2024-01-04 18:07:40 +01:00
David Adam
365027d55d drop obsolete headers 2024-01-02 01:59:02 +08:00
David Adam
118dfe776a drop unused path functions 2024-01-02 01:59:02 +08:00
Johannes Altmanninger
d8feb0bcd1 builtin bind: remove unused parameter
This file uses the questionable "self.somemethod(self.somefield)" pattern.
We should either set the functions free or stop passing redundant parameters.
Not sure.

For now fix one of them to avoid a string clone.
2024-01-01 18:40:34 +01:00
Johannes Altmanninger
971359876d Work in clippy lint 2024-01-01 18:40:34 +01:00
Johannes Altmanninger
69881f4251
Merge pull request #10180 from ridiculousfish/riir-input
Rewrite input machinery in Rust
2024-01-01 18:38:32 +01:00
Fabian Boehm
6618ca17f2 set: Fix set -e without arguments
This didn't actually error out because we passed all of args.

It *might* be cleaner to pass a slice?
2024-01-01 16:21:08 +01:00
ridiculousfish
8190e3419d Add remaining input FFI bits and port builtin_bind
This implements input and input_common FFI pieces in input_ffi.rs, and
simultaneously ports bind.rs. This was done as a single commit because
builtin_bind would have required a substantial amount of work to use the input
ffi.
2023-12-31 17:17:43 -08:00
ridiculousfish
7ffb62d1d9 Port input.cpp to input.rs
This is not yet adopted.
2023-12-31 15:45:08 -08:00
ridiculousfish
01b04c802e Port input_common.cpp to input_common.rs 2023-12-31 15:45:08 -08:00
ridiculousfish
55054a4bae Add keys to our curses Term structure
This will support rewriting the input machinery in Rust.

Note that while there are a lot of keys here, in practice this is very fast -
taking on the order of microseconds to populate.
2023-12-31 15:44:50 -08:00
Johannes Altmanninger
efa37b6a2e Add back poll of change signaller after adding starting fd monitor
This was missed in ce559bc20 (Port fd_monitor (and its needed components),
2023-02-17).

Fixes the wrong color in

    echo (set_color yellow; date +%T; set_color blue)

as reported in https://github.com/fish-shell/fish-shell/issues/10176#issuecomment-1872658589
2023-12-31 11:07:18 +01:00
Johannes Altmanninger
7d10a72bb3 builtin read: enable bracketed paste
We run __fish_enable_bracketed_paste on every shell prompt, and inside
edit_command_buffer. This protects from accidents when pasting control
characters, and makes sure the paste results in a single undo group.

Let's do the same for builtin read.

Found while doing the research for #10101
2023-12-30 16:58:24 +01:00
ridiculousfish
7bd8328243 Fix some clippy lints 2023-12-29 12:17:22 -08:00
Shou Ya
182a42becc fix typo 2023-12-29 14:54:51 +01:00
ridiculousfish
2a46b24526 Remove some unnecessary imports and suppress unused import warnings 2023-12-28 22:11:50 -08:00
Fabian Boehm
e318585021 Don't replace tilde for error messages if we have no $HOME
This was an issue with "--no-execute", which has no variables and
therefore no $HOME:

```fish
fish --no-execute /path/to/file
```

would say the error is in `~/path/to/file`.

Instead, since this is just for a message, we simply return the
filename without doing the replacement.

Fixes #10171
2023-12-28 10:19:48 +01:00
Shou Ya
31d157f117 Disable redundant filtering in history pager
Part of #10143
2023-12-24 08:42:20 +01:00
Johannes Altmanninger
2358d4dec8 Fix MoveWordStyle naming convention 2023-12-24 08:42:20 +01:00
Johannes Altmanninger
e194f35a5e Port test_word_motion 2023-12-22 18:10:29 +01:00
Johannes Altmanninger
afe9013b4c Port test_pthread 2023-12-22 18:10:29 +01:00
Johannes Altmanninger
daf96a35b5 Fix regression treating read -P as -p
Fixes #10161
2023-12-19 08:24:50 +01:00
Johannes Altmanninger
6446289f41 abbrs: fix naming convention 2023-12-17 17:12:13 +01:00
Fabian Boehm
2be36fbfb6 Use c_char instead of a fixed i8
Char signedness sucks sooooo bad.

Anyway, this broke the build on aarch64 linux.
2023-12-10 17:04:01 +01:00
Johannes Altmanninger
c6f7933999 io: use Condvar::wait_while 2023-12-10 14:35:43 +01:00
Johannes Altmanninger
38d52b7835 Port perf_convert_ascii
The "#[bench]" attribute is not allowed in stable Rust, so keep it behind
a new feature flag. Run on nightly Rust with

    $ cargo bench --features=bechmark
    test tests::encoding::bench::bench_convert_ascii ... bench:     125,988 ns/iter (+/- 1,128) = 1040 MB/s
2023-12-10 14:35:43 +01:00
Johannes Altmanninger
f3dd8d306f Port make_autoclose_pipes, fd_event_signaller_t
This allows to get rid of the C++ autoclose_fd_t.
2023-12-10 14:35:43 +01:00
Fabian Boehm
eb196c8330 Encode all ENCODE_DIRECT codepoints with encode_direct
forward-port of 09986f5563
2023-12-10 09:29:42 +01:00
Johannes Altmanninger
e380654fff Port test_convert_nulls 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
a55e95f5fb Port test_env_snapshot 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
fe19cbded0 Port test_wwrite_to_fd 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
d5ccbb6e9c Port test_error_messages 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
f3d1e0d63a Port test_new_parser_errors 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
a7791aab4d Port test_new_parser_ad_hoc 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
d5cfa0e346 Port test_new_parser_ll2 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
af4b8ccc91 Port test_new_parser_fuzzing 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
afddb5dd3e Port test_new_parser_correctness 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
3fab9adab6 Port test_illegal_command_exit_code 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
c74cc71e26 Port rest of test_parser
Most of this is already ported into the "test_parser" test.
2023-12-09 21:35:08 +01:00
Johannes Altmanninger
09b7f3892f Port test_pipes 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
9430d5c542 Port test_wgetopt 2023-12-09 21:35:08 +01:00
Johannes Altmanninger
4217fc9bf6 Address clippy lint for debounce test 2023-12-09 16:54:26 +01:00
Johannes Altmanninger
749e760cf5 Port debounce tests 2023-12-09 16:48:02 +01:00
Johannes Altmanninger
0942ace6c9 Fix begin-undo-group regression
Fixes #10145
2023-12-09 16:12:54 +01:00
Johannes Altmanninger
8fe82fcfcf build.rs: remove rebuild_if_path_changed for C files
Repeated

    CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo b

show that we always rebuild because of "compat.c".  Not sure why.
Let's disable this for now so we can use the cache (for test targets etc.).
2023-12-09 16:11:42 +01:00
Johannes Altmanninger
f118dbc4b9 Fix "fish --private" regression
Introduced in eacbd6156 (Port and adopt main written in Rust, 2023-08-18).

Fixes #10146
2023-12-09 09:34:57 +01:00
Johannes Altmanninger
bb16cad9dc Simplify call to is_sorted_by()
I con no longer reproduce an error/warning for this.
2023-12-06 19:01:22 +01:00
Johannes Altmanninger
360c9043cb Disable unstable_name_collisions warning
We rarely attach trait methods to stdlib types so this warning is unlikely to
be a true positive It is a false positive for the methods defined in future.rs.
It's not always obvious which method is selected when it's available in the
stdlib but I haven't seen a build failure yet.  So let's disable the warning.

In future we might be able suppress it per method, see Rust issue 48919.
2023-12-06 19:00:37 +01:00
Johannes Altmanninger
b361d1a0cf Address some clippy lints
I got these with clippy 1.67 but not with 1.73 (possible regression?).
2023-12-06 19:00:37 +01:00