Commit Graph

10 Commits

Author SHA1 Message Date
Johannes Altmanninger
b00899179f Don't indent multi-line quoted strings; do indent inside ()
On a command with multiline quoted string like

    begin
        echo "line1
    line2"
    end

we actually indent line2 which seeems misleading because the indentation
changes the behavior when typed into a script.

This has become more prominent since commits
- a37629f86 (fish_clipboard_copy: indent multiline commands, 2024-04-13)
- 611a0572b (builtins type/functions: indent interactively-defined functions, 2024-04-12)
- 222673f33 (edit_command_buffer: send indented commandline to editor, 2024-04-12)

which add indentation to an exported commandline.

Never indent quoted strings, to make sure the rendering matches the semantics.
Note that we do need to indent the opening quote which is fine because
it's on the same line.

While at it, indent command substitutions recursively.  That feature should
also be added to fish_indent's formatting mode (which is the default).
Fortunately the formatting mode already works fine with quoted strings;
it does not indent them. Not sure how that's done and whether indentation
can use the same logic.
2024-04-30 14:12:48 +02:00
Johannes Altmanninger
29be454652 Move parse_util tests to separate file 2024-04-30 14:00:06 +02:00
Johannes Altmanninger
5b324f8ecb Fix regression in parse_util_process_extent
Found on a two-line commandline

    for file in (path base<TAB>
    echo
2024-03-24 16:34:36 +01:00
Johannes Altmanninger
3cfa09d1bd Make test_init() return a scope guard
To be used in the next commit.
2024-03-24 16:33:35 +01:00
The0x539
4c3e814a50 Address clippy lints 2024-03-09 13:49:25 +01:00
Fabian Boehm
f7b541af99 tests/parse_util: Check against localized message
This is run in the current locale, without resetting to en_US.UTF-8
like our integration tests do.

So if you want to check for a specific message you need to check the
localized version.
2024-01-20 12:28:59 +01:00
Himadri Bhattacharjee
e014c981f2 Disallow background operator before && or ||
Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>

Closes #10228
Fixes #9911
2024-01-20 11:32:44 +01:00
Johannes Altmanninger
87d434a98d Improve failure message in test_error_messages 2024-01-20 11:30:13 +01:00
Johannes Altmanninger
7597288c18 test_error_messages: add back missing validation
Make sure to also look for the error part that occurs after the last format
specifier.

Still not great because it won't fail if there's unexpected output at the
beginning or end of the string.
2024-01-19 06:26:31 +01:00
Johannes Altmanninger
3ae20bdba0 Move fish-rust to project root 2024-01-13 03:58:33 +01:00