Commit Graph

20622 Commits

Author SHA1 Message Date
Peter Ammon
27dc4b3c8a ast: Blanket implementation of NodeMut
Continue to shrink the implement_node! macro.

No functional changes expected.
2025-05-04 17:09:00 -07:00
Peter Ammon
77a4f38a13 ast: derive Category from Type
In the fish AST, each node falls into one of three "categories":

    1. A branch: contains child nodes
    2. A leaf: no child nodes, contains a source range
    3. A list: a sequence of child nodes and nothing more

Prior to this commit the category was explicit in the code for each Node type;
make it instead derived from the node's type. This continues to shrink our
macros.

No functional change expected.
2025-05-04 17:09:00 -07:00
Peter Ammon
e9d396615b ast: push try_source_range into default Node implementation
Minor refactoring, reducing macro size.
2025-05-04 17:09:00 -07:00
Peter Ammon
79ec558d08 ast: remove Default implementation
This doesn't make much conceptual sense, and isn't required.

Do some other miscellaneous cleanup.
2025-05-04 17:09:00 -07:00
Peter Ammon
719a5d2909 ast: remove stale parent pointer comment
It no longer applies.
2025-05-04 17:08:59 -07:00
Peter Ammon
93962c82df ast: store &dyn Node and not &dyn NodeMut
Minor simplifications.
2025-05-04 17:08:59 -07:00
Johannes Altmanninger
111922b60f Fix export test on macOS GHA runner
This system sets something like
$MANPATH: originally inherited as |/Applications/Xcode_15.4.app/...|
2025-05-04 18:19:42 +02:00
Johannes Altmanninger
cb92a5530f functions/export: fix for path variables
Commit f38646593c (Allow `export` to set colon-separated `PATH`, `CDPATH`
and `MANPATH`., 2017-02-10)
did something very weird for «export PATH=foo».
It essentially does

	set -gx PATH (string replace -- "$PATH" (string join ":" -- $PATH) foo)

which makes no sense.  It should set PATH to "foo", no need to involve the
existing value of $PATH.

Additionally, the string split / string join dance is unnecessary.  Nowadays,
builtin set already handles path variables as is needed here, so get rid of
this special case.

Fixes #11434
2025-05-04 18:06:18 +02:00
Johannes Altmanninger
dd4c04e2ff Fix empty soft-wrapped line not being removed before execution
Commit 7acc2b7 added an empty line to our screen representation if we are
wrapped. This regressed the fix for #6826.  In the attached test case, there is
a spurious empty line after the first one.  Adjust the fix to remove it again.

Patch-by: kerty <g.kabakov@inbox.ru>
https://github.com/fish-shell/fish-shell/pull/11153#issuecomment-2800087389
2025-05-04 12:50:12 +02:00
Johannes Altmanninger
6fec5ab320 completions/wpctl: fix when "settings" subcommand is not available
The error is printed to stdout, see
https://github.com/fish-shell/fish-shell/pull/11438#discussion_r2072455009
2025-05-04 12:06:01 +02:00
Johannes Altmanninger
ada9aff63e Merge pull request #11453 2025-05-04 12:01:06 +02:00
Johannes Altmanninger
1d63c1f188 Merge pull request #11399 2025-05-04 11:58:05 +02:00
Johannes Altmanninger
a12298152f Merge pull request #11448 2025-05-04 11:57:18 +02:00
Bergbok
83b10c3919 Rephrase set_color tutorial docs
Closes #11446
2025-05-04 11:56:14 +02:00
Johannes Altmanninger
4a3fc5211f Document workaround for making tab focus search field
Closes #11450
Closes #11449
2025-05-04 11:56:14 +02:00
239
9f80e1f225 completions/keybase: update to 6.4.0
Closes #11428
2025-05-04 11:56:14 +02:00
fabiojb
9a8d578142 completion(winetricks): redirect winetricks list-all sderr to /dev/null 2025-05-03 18:25:17 -03:00
Daniel Rainer
09eae92888 Make printf unicode-aware
Specifically, the width and precision format specifiers are interpreted as
referring to the width of the grapheme clusters rather than the byte count of
the string. Note that grapheme clusters can differ in width.

If a precision is specified for a string, meaning its "maximum number of
characters", we consider this to limit the width displayed.
If there is a grapheme cluster whose width is greater than 1,
it might not be possible to get precisely the desired width.
In such cases, this last grapheme cluster is excluded from the output.

Note that the definitions used here are not consistent with the `string length`
builtin at the moment, but this has already been the case.
2025-05-03 22:53:27 +02:00
Daniel Rainer
af6c3eb69f Ensure that strings do not get wrapped in po files 2025-05-03 16:07:20 +02:00
Daniel Rainer
dd5864ce13 Add quotes around gettext string
This should prevent occurrences of the search string from being found in other
locations (e.g. in a comment).

The whole approach of string extraction from Rust sources is sketchy,
but this at least prevents producing garbage when the content of a string
appears somewhere else unquoted.
2025-05-03 16:07:20 +02:00
Daniel Rainer
d31dc9ffd8 Fix fish script translation file generation
The previous version generates files which do not preserve the line number from
the original fish script file, resulting in translation not working.

The new approach is quite ugly, and might have some issues,
but at least it seems to work in some cases.
2025-05-03 16:07:03 +02:00
Daniel Rainer
d5e80d43d9 Extract function for gettext extraction
Extracting explicit and implicit messages works essentially the same way, which
is also reflected in the code being identical, except for the regex.

Extract the duplicated code into a function.
2025-05-03 16:03:03 +02:00
Johannes Altmanninger
0d59e89374 completions/wpctl: silence stderr
In case the command is missing, I guess
See https://github.com/fish-shell/fish-shell/pull/11438
2025-05-03 14:15:33 +02:00
Johannes Altmanninger
8b1f72c54b completions/tmutil: namespace 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
54a5ade57d Merge pull request #11394 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
7c25d6a1ba Merge pull request #11443 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
a5a5dc46e4 Merge pull request #11438 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
1687b3fe7a Merge pull request #11377 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
f3ddf793a3 Merge pull request #11381 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
647ae7da8c Merge pull request #11411 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
0950cd1598 Merge pull request #11422 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
a1b1bff97b Merge pull request #11441 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
a95be351fb Merge pull request #11447 2025-05-03 14:15:33 +02:00
Axlefublr
91b9bbf651 fix single backticks 2025-05-03 19:26:07 +08:00
Johannes Altmanninger
c14e8c1939 Fix assertion error in set_color
This doesn't hold for e.g. TERM=linux-m fish -c 'set_color red'
2025-05-03 12:56:45 +02:00
Daniel Rainer
7e4c3b9fa7 Use workspace config in packages
- Apply lint config to entire workspace

- Inherit workspace config for fish-printf

- Allow stdlib printing in fish-printf tests

The current problem which is addressed by this is that warnings about C-String
literals are generated by clippy for code in fish-printf. These literals are not
available with the current MSRV 1.70, but previously the MSRV setting was not
inherited by fish-printf, causing the warning to appear.
2025-05-02 22:31:39 +02:00
Fabian Boehm
8048e38ea4 docs: Actually document commandline --input
This is a useful option and has been a thing for years.
2025-05-02 20:55:36 +02:00
Fabian Boehm
8a5a547d88 builtins/commandline: Correct error message 2025-05-02 20:54:29 +02:00
Johannes Altmanninger
48704dc612 Fix regression causing crash indenting commandline with "$()"
Commit b00899179f (Don't indent multi-line quoted strings; do indent inside
(), 2024-04-28) changed how we compute indents for string tokens with command
substitutions:

	echo "begin
	not indented
	end $(
	begin
	    indented
	end)"(
	begin
	    indented
	end
	)

For the leading quoted part of the string, we compute indentation only for
the first character (the opening quote), see 4c43819d32 (Fix crash indenting
quoted suffix after command substitution, 2024-09-28).

The command substitutions, we do indent as usual.

To implement the above, we need to separate quoted from non-quoted
parts. This logic crashes when indent_string_part() is wrongly passed
is_double_quoted=true.

This is because, given the string "$()"$(), parse_util_locate_cmdsub calls
quote_end() at index 4 (the second quote). This is wrong because that function
should only be called at opening quotes; this is a closing quote. The opening
quote is virtual here. Hack around this.

Fixes #11444
2025-05-02 08:31:15 +02:00
Johannes Altmanninger
8abab0e2cc Explicit type for "$()" hack in parse_util_locate_cmdsub 2025-05-02 08:31:15 +02:00
Johannes Altmanninger
bd178c8ba8 Remove code clone in parse_util_locate_cmdsub 2025-05-02 08:31:15 +02:00
Johannes Altmanninger
cb719cd418 Remove dead code
Introduced in 149594f974 (Initial revision, 2005-09-20).
2025-05-02 08:31:15 +02:00
Johannes Altmanninger
1ff8f983c4 Remove obsolete Vi mode delete key workaround
As reported in
https://matrix.to/#/!YLTeaulxSDauOOxBoR:matrix.org/$n20_uqiMqatEQcPG79Ca0c2_YvHBHTr-yCVXTEuze_Y

commit f5fac096c0 (Don't move cursor in delete-char, 2017-04-19) fixed the
behavior of Vi mode keys "delete" and "x" when the cursor is at the end of
the buffer, and commit d51f669647 (Vi mode: avoid placing cursor beyond
last character, 2024-02-14) generalized this fix.

This means that the delete-specific fix is no longer necessary. Remove it.

Note that if the cursor is at end of a line but not the last line, the
behavior of "delete" in Vi mode is still wrong.  It should stay on the line.
2025-05-02 06:05:31 +02:00
Johannes Altmanninger
e3517f69b3 Simplify check for bare builtin invocation 2025-05-02 06:05:31 +02:00
Fabian Boehm
f7bde1354d Only count it as a naked invocation at the end of the "file"
This is a weird confusion between the "end" and "terminate" token
types.

"end" is the end of the "line" - a newline or ";".

"terminate" is the end of the "file" - like pressing newline
interactively or having the file end.

So this would count things like `if` and `switch` as a "help"
invocation even if followed by a newline, e.g.

```fish
if; echo foo
```

and

```fish
switch
case foo
```

The result of that was that a naked "if" in a script file isn't an
error, but doesn't start a block either, so if you complete the block
it would count the "end" as superfluous, which sends you on a bit of a
hunt to figure out where the block start is missing.
2025-05-01 14:57:30 +02:00
Axlefublr
1d69226c58 preciser wording for builtin crossmode alt+p binding 2025-05-01 13:58:18 +08:00
Daniel Rainer
d5e71bc46e Fix diff_profiles.fish
This script was broken by the changes to profiling output in
9d904e1113.

The new version works with both the old and new profiling output, even when
mixed. The script output has been adjusted to match the new profiling style
better.

This also adds basic error handling for situations where the script is invoked
incorrectly and makes the file executable.
2025-04-30 19:41:45 +02:00
fabiojb
0d5ab2514c wpctl: add description for settings command options 2025-04-30 11:18:12 -03:00
David Adam
bf0a30b9a8 CHANGELOG: work on 4.1 2025-04-30 14:15:58 +08:00
fabiojb
b54042e512 wpctl: add completion for settings option 2025-04-29 17:11:01 -03:00