Commit Graph

19136 Commits

Author SHA1 Message Date
Peter Ammon
631516398e
Remove the notion of the "principal" environment stack
The "principal" environment stack was the one that was associated with the
"principal" parser and would dispatch changes like to TZ, etc.

This was always very suspicious, as a global; now we can remove it.
2024-06-23 16:49:11 -07:00
Peter Ammon
dbf54f49ff
Remove principal_parser() from the last of the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
fd84dc4cdd
Remove principal_parser() from yet more of the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
2bd3bcf7fc
Remove principal_parser() from yet more of the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
0d7e8c22a6
Remove principal_parser() from yet more of the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
077f439283
Remove uses of EnvStack::principal() in the tests 2024-06-23 16:49:11 -07:00
Peter Ammon
0e96a420d6
Remove a use of EnvStack::principal()
Try to get off of globals.
2024-06-23 16:49:11 -07:00
Peter Ammon
01d45ad755
Clarify a comment about safety in the environment impl
We use an unusual pattern of protecting data via a global lock, but it's safe.
2024-06-23 16:49:11 -07:00
Peter Ammon
0378cb750b
Be more explicit about when to dispatch variable changes
This controls e.g. when we react to TZ changes. Rather than having a special
blessed environment stack, simply store it as a property.
2024-06-23 16:49:11 -07:00
Peter Ammon
9ad875cdb7
Enforce that nobody can push/pop from the global environment stack
This is just a precaution.
2024-06-23 16:39:39 -07:00
Peter Ammon
7fcbe5b8ab
Thread variables into autoload_names
Stop fetching a global set of variables.
2024-06-23 16:39:39 -07:00
Peter Ammon
d2d2d8cb45
Remove the shared_from_this for Parser
We no longer need this.
2024-06-23 16:39:39 -07:00
ridiculousfish
924d6aac71
Remove another call to current_data()
Continue to get off of globals.
2024-06-23 16:39:39 -07:00
ridiculousfish
dee692759a
Split Reader off from ReaderData
Prior to this commit, there was a stack of ReaderDatas, each one has a
reference to a Parser (same Parser in each, for now). However, the current
ReaderData is globally accessible. Because it holds a Parser, effectively
anything can run fish script; this also prevents us from making the Parser
&mut.

Split these up. Create ReaderData, which holds the data portion of the
reader machinery, and then create Reader which holds a ReaderData and a
Parser. Now `reader_current_data()` can only return the data itself; it
cannot execute fish script.

This results in some other nice simplifications.
2024-06-23 16:39:39 -07:00
ridiculousfish
dfd948fcb5
Eliminate a call to reader_current_data
Try to get off of these globals.
2024-06-23 16:39:39 -07:00
ridiculousfish
c297df38c7
Migrate the Inputter type to a trait
This is a start on untangling input. Prior to this, a ReaderData and an
Inputter would communicate with each other; this is natural in C++ but
difficult in Rust because the Reader would own an Inputter and therefore
the Inputter could not easily reference the Reader. This was previously
"resolved" via unsafe code.

Fix this by collapsing Inputter into Reader. Now they're the same object!
Migrate Inputter's logic into a trait, so we get some modularity, and then
directly implement the remaining input methods on ReaderData.
2024-06-23 16:39:39 -07:00
ridiculousfish
c9a76bd634
Make OperationContext not hold a Parser via Rc
Exploit Rust's lifetimes. This will lead to simplifications.
2024-06-23 16:39:39 -07:00
ridiculousfish
d36f94d96c
Remove additional call to Parser::shared() 2024-06-23 16:39:39 -07:00
ridiculousfish
832ed31687
Start removing calls to Parser::shared()
Parser::shared() gets an Rc to a Parser, but we can do without it.
Let's aim to get rid of the cyclic ref.
2024-06-23 16:39:39 -07:00
Mahmoud Al-Qudsi
245ee466cb completions/magento: remove sed dependency
This runs in about half the time, too.
2024-06-23 18:08:34 -05:00
Jean-Bernard Valentaten
3c74f14569
completions/magento: Fixes module aggregation for module related commands (#10446)
* completions/magento: Fixes module aggregation for module related commmands

Previousely when attempting completion for commands `module:enable`,
`mmodule:disable` and `module:uninstall` and error would be disaplyed,
stating that "magento" was not found.
Upon inspection of the issue in the related completion script it became
clear that:
1. The shell command `magento` does not exist as the CLI script of
   Magentoresides under `bin/magento`.
2. The module aggregation would not work after referncing the
   appropriate CLI command as an undeclared variable was being
   introspected.
3. Using Magento's CLI command took too long to respond as it has to
   bootstrap the whole Magento stack in order to deliver modules.

Thus the whole aggregation was rewritten to a form that actually works
and reduces the aggregation to reading the appropriate information
directly from the configuration file, provided that the file exists and
PHP is installed.

* completions/magento: Refactors module aggregation for module related commmands to not use PHP script

Executing random scripts from fish completion poses a threat to the
system. While this would indicate that the Magento installation has been
corrupted, it still is better to not run `app/etc/config.php` to get
hold of the modules.
Thus the module aggregation was rewritten to make use of `sed` instead,
which has the additional benefit of being faster than using PHP.
2024-06-23 18:05:52 -05:00
Mahmoud Al-Qudsi
2f46186f2b Fix formatting 2024-06-23 18:01:31 -05:00
Mahmoud Al-Qudsi
1a18d06a57 math: Fix copy-and-paste error in error message 2024-06-23 17:53:49 -05:00
Mahmoud Al-Qudsi
1a7a7a5dcb math: Support abbreviated scale modes 2024-06-23 17:52:14 -05:00
Mahmoud Al-Qudsi
80c02400eb Fix hard-coded decimal separator in builtin math 2024-06-23 17:50:02 -05:00
Mahmoud Al-Qudsi
c0028a0ec9 math: Rename ZeroScaleMode
It's no longer only for the zero scale.
2024-06-23 17:47:21 -05:00
Looouiiis
480d48351c feat(math): add round options (#9117)
Add round options, but I think can also add floor, ceiling, etc. And
the default mode is trunc.

Closes #9117

Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
2024-06-23 17:45:52 -05:00
Mahmoud Al-Qudsi
f1ae170155 printf: Ignore some floating point tests under i586
A few specific tests fail under i586 due to its inherent floating point
inaccuracy issues (rust-lang/rust#114479), so ignore these tests if certain
are met.

We have specific integration tests elsewhere in fish to check that even under
i586 we get mostly sane results, so this is OK. I tried to modify the assert
macros to check for a loose string match (up to one character difference) or an
f64 abs diff of less than epsilon, but it was a lot of code with little value
and increased the friction to contributing to the tests. Also, let's just
acknowledge the fact that all of i686, let alone i586 specifically, is a dead
end and not worth investing such time and effort into so long as it more or less
"works".

Closes #10474.
2024-06-23 16:14:02 -05:00
Mahmoud Al-Qudsi
7d1942a023 Add reduced-accuracy variants of some math tests under x86
Due to the inherent floating point accuracy issues under i586 described
in #10474 and at https://github.com/rust-lang/rust/issues/114479, we need to add
a workaround to our littlecheck math tests to perform less stringent comparisons
when fish was built for x86 without SSE2 support.

This commit addresses the littlecheck issues that caused #10474 to be re-opened,
but I still have to reproduce the cargo test failures for
`negative_precision_width`, `test_float`, `test_float_g`, and `test_locale`.
2024-06-23 16:14:02 -05:00
Lzu Tao
e0266067c4 git: completion for git commit --edit 2024-06-22 20:00:31 +00:00
Fabian Boehm
d917b89009 docs: Fix two links 2024-06-22 14:58:07 +02:00
Mahmoud Al-Qudsi
59daa5abce
Run 32-bit CI tests as i586 (#10578) 2024-06-21 12:45:54 -05:00
Mahmoud Al-Qudsi
298cdb0c5b Always pass --target to cargo test when CMake Rust_CARGO_TARGET is set
The CMake `cargo test` integration was broken if Rust_CARGO_TARGET were used
with `CARGO_FLAGS` set to `-Zbuild-std` (e.g. to target i586 under i686 without
the i586 toolchain installed).
2024-06-21 12:00:10 -05:00
Florian Meißner
14fd7bd9af
Explain function --argument-names in more detail. (#10524) 2024-06-19 22:51:47 -05:00
Mahmoud Al-Qudsi
32a5be52e1 Add note about non-ASCII decimal_sep length 2024-06-19 18:50:24 -05:00
Mahmoud Al-Qudsi
28a3ae7a8b Remove Clone bound on parse_dec_float()
It's not necessary to clone the character iterator at all.
Also move rarely used inf/nan parsing to own cold function.
2024-06-19 18:43:53 -05:00
Peter Ammon
373cef08cc
Fix a clippy in ulimit 2024-06-19 10:47:46 -07:00
Schlomo Schapiro
b3a16e0993
Show only writeable volumes
to exclude system volume
2024-06-19 09:17:14 -07:00
Schlomo Schapiro
f0c8f7406c
Extend diskutil eject to suggest volumes
Extend `diskutil eject` completion to also suggest mounted volumes.

Fixes #10573
2024-06-19 09:17:14 -07:00
Manuel Krebs
27c7578760 Add completions for dust 2024-06-19 02:10:52 +02:00
David Adam
e95fc104ec CHANGELOG #830 2024-06-17 06:36:38 +08:00
Peter Ammon
5cc9e0187e
Suppress an annoying warning about non-camel-case types 2024-06-16 11:49:09 -07:00
Peter Ammon
376bdb16c7
Fix a misspeeled comment 2024-06-15 16:20:15 -07:00
Peter Ammon
5a45b189da
Make EnvStackSetResult use Rust naming conventions 2024-06-15 15:57:28 -07:00
Peter Ammon
0c20ccc72d
Fix an annoying warning about camel case types 2024-06-15 13:46:45 -07:00
Peter Ammon
4d300b7f32
Correct fish_default_key_bindings docs
These referred to vi key bindings, not emacs.

Credit to chapeupreto for spotting this in #10569.
2024-06-15 12:18:37 -07:00
Peter Ammon
aa83e155f5
Correct changelog for #10394 2024-06-15 12:16:55 -07:00
Lzu Tao
d370adf5fe git: allow path completion after git reset -- 2024-06-15 11:59:24 -07:00
Peter Ammon
61a90deb8f
Changelog fix to #10394 2024-06-15 11:50:35 -07:00
iselda aiello
bac222e001 Move cursor back one space when deleting in vi visual mode
Fixes #10394
2024-06-15 11:44:32 -07:00