Commit Graph

19133 Commits

Author SHA1 Message Date
Fabian Boehm
61bf839991 Update README 2024-06-12 08:11:16 +02:00
Fabian Boehm
84b5701b92 Port fish_test_helper to C
This is the last piece of C++, so now we can remove the need for a C++
compiler.

We need one for C anyway (libc.c).

Fixes #10549
2024-06-12 08:11:16 +02:00
Shun Sakai
525a39b42c Add completions for actionlint 2024-06-12 08:10:57 +02:00
Mark Huang
1d8b10399a apt list completions 2024-06-12 08:10:38 +02:00
Fabian Boehm
04da7043a6 tests: Remove skipped tests hack for Cmake < 3.9.0
We require 3.19

This also makes skipped tests visible, which showed that the
print-help test was never run because the REQUIRES line was off.

In sh-mode, bash's `command -v` returns true if *all* commands exist.
2024-06-11 16:55:11 +02:00
Fabian Boehm
32d23a37cb format 2024-06-10 17:16:19 +02:00
Fabian Boehm
652996124d reader: Remove a panic
The special input functions self-insert, self-insert-not-first, and
and or used to be handled by inputter_t::readch, but they aren't
anymore with `commandline -f`.

I am unsure if these *would* have worked, I can't come up with a use.

So, for now, do nothing instead of panicking.
2024-06-10 17:14:13 +02:00
Fabian Boehm
c7d878a8d2 input: Let function_pop_arg return an Option
This would crash if you ran `commandline -f backward-jump`.

The C++ version would read a char (but badly), this doesn't anymore.

So, at least instead of crashing, just do nothing.
2024-06-10 17:02:11 +02:00
David Adam
19d92a9476 make_vendor_tarball: stop trying to excise winapi
errno no longer depends on winapi, and nothing else does either. Stop
trying to remove it.
2024-06-10 22:13:27 +08:00
ridiculousfish
20e9c9493c Rewrite float parsing to use Rust native parsing
Eliminates the fast-float dependency.
2024-06-09 15:52:13 -07:00
ridiculousfish
838ff86ae7 Rename printf crate to fish-printf
Preparing to publish to crates.io
2024-06-09 12:29:09 -07:00
ridiculousfish
56ea456ca3 Add description and license to printf Cargo.toml 2024-06-09 12:20:05 -07:00
ridiculousfish
02532f8bb8 Mark that our printf is licensed under MIT 2024-06-09 12:15:04 -07:00
Fabian Boehm
251ddd1bcc Revert "builtins/path: Use fancy bitflags feature"
This builds on my machine, but doesn't on CI.

Rust 1.67 possibly needs to derive Eq as well as PartialEq?

This reverts commit 2fa0f13db2.
2024-06-08 09:12:56 +02:00
Fabian Boehm
2fa0f13db2 builtins/path: Use fancy bitflags feature
Just a cleanup TODO, no functional changes intended
2024-06-07 21:49:49 +02:00
Fabian Boehm
ab0fdd1918 Remove unescape_string_in_place
Only used in two places and did not do anything sensible
2024-06-06 17:11:25 +02:00
Fabian Boehm
364c53c5e5 CHANGELOG 2024-06-06 16:50:13 +02:00
Fabian Boehm
d317e3638c Update the other dependencies 2024-06-06 16:47:52 +02:00
Fabian Boehm
ad73dcc308 Update nix to 0.29 2024-06-06 16:47:52 +02:00
Fabian Boehm
f59cdfaa8d fish_add_path: Be more informative in verbose mode
One issue with fish_add_path at the moment is that it is sometimes a bit too intransparent.

You'll try to add a path, but it won't appear - was that because it wasn't a directory,
or because it doesn't exist, or because it was already included?

If it isn't usable after, did fish_add_path not add it because of something or did something *else* remove it?

So we give more explanations - "skipping this because it's a file", "not setting anything because no paths are left to add", ...
2024-06-06 16:47:39 +02:00
Fabian Boehm
6706b15fbc fish_add_path: Automatically enable verbose mode for interactive use
fish_add_path can be used either interactively, in the commandline,
or in config.fish. That's its greatest strength, it's a very
DWIM-style command.

One of the compromises that entails, however, is that it can't really
be very loud about what it does. If it skips a path, it can't write a
warning because it might be used in config.fish.

But it *can* if it's used interactively. So we try to detect that case
and enable verbose mode automatically.

That means if you do

```fish
fish_add_path /opt/mytool/bin/mytool
```

it may tell you "Skipping path because it is a file instead of a
directory:".

The check isn't perfect, it goes through status current-command and
isatty, but it should be good for most cases (and be false in config.fish).
2024-06-06 16:47:39 +02:00
Fabian Boehm
3411b72a6d Curses: Update the comments 2024-06-04 22:23:46 +02:00
Fabian Boehm
90bd8cc02b Remove errant .rs2 file 2024-06-04 21:55:43 +02:00
tesuji
01e958d2fb
git: add completion for sparse-checkout subcommand (#10542) 2024-06-02 22:02:06 -05:00
Mahmoud Al-Qudsi
9f0e034fad Fix curl data string from path completions
Closes #10539.
2024-06-02 21:58:54 -05:00
Mahmoud Al-Qudsi
d90d924c8c Remove parser library_data_pod_t ffi workaround
We don't need to separate POD fields from the main parser libdata any more.
2024-06-02 20:27:44 -05:00
ridiculousfish
abf92fcbd1 Fix the bind.py tests
Errant newlines were causing extra prompts.
2024-06-02 15:47:15 -07:00
ridiculousfish
c0766c1844 Fix the histfile.py test
Add missing expect_prompt()
2024-06-02 15:31:19 -07:00
ridiculousfish
cb62ed3e3d Bravely reenable fg.py in CI for Mac 2024-06-02 15:11:51 -07:00
ridiculousfish
96faad247f Fix the fg.py pexpect test 2024-06-02 15:07:23 -07:00
ridiculousfish
25ac5bdb49 Fix the undo pexpect
Add the missing expect_prompts to reflect where we send newlines.
2024-06-02 14:17:36 -07:00
ridiculousfish
15c0313c33 Fix pexpect_helper.py prompt regex
The prompt regex for pexpect was:

```
    return re.compile(
        r"""(?:\r\n?|^)   # beginning of line
            (?:\x1b[\d[KB(m]*)* # optional colors
            (?:\x1b[\?2004h) # Bracketed paste
            (?:\x1b[>4;1m) # XTerm's modifyOtherKeys
            (?:\x1b[>5u) # CSI u with kitty progressive enhancement
            (?:\x1b=) # set application keypad mode, so the keypad keys send unique codes
            (?:\[.\]\ )?  # optional vi mode prompt
         """
        + (r"prompt\ %d>" % counter)  # prompt with counter
        + r"""
            (?:\x1b[\d\[KB(m]*)* # optional colors
        """,
        re.VERBOSE,
    )
```

This has a terrible bug: an accidentally unescaped bracket here:

    (?:\x1b[>4;1m) # XTerm's modifyOtherKeys
           ^

This bracket then extends throughout the entire regex, and is
accidentally terminated here:

    (?:\x1b[\d\[KB(m]*)* # optional colors
                    ^

Thus the whole regex is busted; in particular the prompt counters are
not being tested correctly.

A second issue is that these escape sequences are not emitted before the
first prompt, so correcting the regex will cause every test to fail.

Fix this by ignoring all of the escape sequences and merely look for
the "prompt %d>" portion.

THIS DELIBERATELY CAUSES TEST FAILURES.

The tests were already broken and falsely reported as passing.
These will be fixed in followup commits.

Good news is that the tests should become way more reliable after
this is fixed - hopefully no more introducing random sleep() calls.
2024-06-02 14:07:35 -07:00
Fabian Boehm
28484e2498 CHANGELOG: Fix issue mention 2024-06-02 10:52:11 +02:00
Fabian Boehm
94644e88fb Revert "Reduce size of Block to 32 bytes"
This doesn't pull its weight. Block size is not a particularly big
problem,
and this both complicates the code a bit and would arbitrarily cause issues
if a fish script exceeded 65k lines.

This reverts commit edd6533a14.
2024-06-02 10:44:15 +02:00
Mahmoud Al-Qudsi
ac40807309 Reduce explicit Block state
This doesn't have any effect on the size of the struct (due to alignment
requirements and padding) but reduces the complexity by turning
Block::wants_pop_env into an emergent property dependent on the type rather than
something we have to manually manage.
2024-06-01 13:16:24 -05:00
Mahmoud Al-Qudsi
2e52d51af2 Convert Block::event_blocks to a bool
We only increment it and check if it's non-zero, we never decrement or check the
actual count. As such, change it to a bool and bring the size of `Block` down
from 32 to 24 bytes.
2024-06-01 13:01:40 -05:00
Mahmoud Al-Qudsi
edd6533a14 Reduce size of Block to 32 bytes
We don't need 16 bytes (plus the `Option` overhead) to store the line number!
2024-06-01 12:49:15 -05:00
Mahmoud Al-Qudsi
5ca76564a4 Store BlockData in a Box
We almost never access any of this and having it stored directly in the `Block`
struct increases its size (reducing how many we can fit in L1 and L2, and
increasing memory copy traffic).

Gets rid of BlockData::None so we can avoid allocating a Box at all when we have
no data (at the cost of yet-another-wrapper-type), which is the usual case.
2024-06-01 11:41:32 -05:00
Mahmoud Al-Qudsi
1d159277c6 Move Block fields specific to certain block types to separate enum
This has a few advantages,
* We now statically assert that all fields used by a particular block type are
  correctly initialized (i.e. you can't assign the function name but forget to
  assign its arguments),
* Conversely, we can match directly on `BlockData` and be guaranteed that the
  fields we want to access are initialized and present,
* We reduce the number of assertions, effectively "unwrapping" only once based
  off the block type instead of each time we try to access a conditional field,
* We reduce the size of the `Block` struct by coalescing fields that cannot
  co-exist, bringing it down from 104 bytes to 88 bytes.

It would be nice to make all of `Block` itself an enum, but it currently
requires `Copy` and we take advantage of that to copy it around everywhere.
Putting these fields directly in `Block` directly would mean a lot more memory
traffic just checking block types.
2024-06-01 11:15:19 -05:00
Mahmoud Al-Qudsi
0246c938ca Coalesce BlockType::function_call and BlockType::function_call_no_shadow
There's no need for two separate block types when one is merely a variant of the
other. This may have been required under C++ but thanks to sum types (rust's
enums) we don't need to do that any more.
2024-05-31 20:53:52 -05:00
Mahmoud Al-Qudsi
fc9a743622 completions/env: overhaul completions
The value completions were rendered almost entirely useless due to the forced
inclusion of file completions at all tokens, including in the head/command
position thanks to the use of `__fish_complete_subcommand` which doesn't
understand the semantics of `env` and expects something like `ssh`. But we don't
need it at all.
2024-05-31 20:49:48 -05:00
Mahmoud Al-Qudsi
6ec09260dd Changelog: document #5263 and provide workaround
[ci skip]
2024-05-31 16:21:24 -05:00
Mahmoud Al-Qudsi
417e89a4b3 Work around WSLv1 not properly cleaning up stopped orphaned jobs
See #5263.
2024-05-30 21:31:04 -05:00
Mahmoud Al-Qudsi
6c944debec Send signals in the correct order in hup_jobs()
If the backgrounded/stopped job was using the tty, sending it SIGCONT first
might cause it to immediately wake and try to use the tty (which fish still has
control over), causing it to immediately stop again after receiving a SIGTTOU.

We are supposed to send SIGHUP first so that when the process resumes it sees
the queued SIGHUP and executes its registered handler!
2024-05-30 18:26:13 -05:00
Mahmoud Al-Qudsi
e1ee193822 Speed up __fish_make_cache_dir
Don't fork/exec an external process, especially one performing IO, if we don't
have to.

This, in turn, speeds up __fish_source_cached_completions which is rather slow
under WSL (and slower than it needs to be on other platforms).
2024-05-30 17:03:03 -05:00
Mahmoud Al-Qudsi
98642d307a Don't use a graphical browser under SSH
...unless X is also being forwarded.

Someone else will have to figure out the Wayland equivalent (if that even
exists). Not my monkey, not my circus.
2024-05-30 16:15:07 -05:00
Mahmoud Al-Qudsi
7d77d7aa84 Convert more block iteration methods to use iterators 2024-05-30 15:54:54 -05:00
Fabian Boehm
0a8fd05bb0 docs/fish_add_path: Reword description
Use "directories" explicitly instead of "components" to make it more
clear that the arguments need to be directories, not files.

Also a bit on intent and variable scope.
2024-05-30 22:52:03 +02:00
Mahmoud Al-Qudsi
f6200224fc Use Iterator::count() to check function stack depth 2024-05-30 12:49:28 -05:00
Mahmoud Al-Qudsi
b495cffa50 fixup! Add workaround for targets with too small a main stack size 2024-05-30 12:25:06 -05:00