mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 00:01:15 -03:00
fish_indent: fix extra indent of continuation lines inside blocks
fish_indent used to increment the indentation level whenever we saw an escaped newline. This broke because of recent changes to parse_util_compute_indents(). Since parse_util_compute_indents() function already indents continuations there is not much to do for fish_indent - we can simply query the indentation level of the newline. Reshuffle the code since we need to pass the offset of the newline. Maybe this can even be simplified further. Fixes #7720
This commit is contained in:
@@ -389,3 +389,19 @@ echo 'if true; and false; or true
|
||||
end' | $fish_indent --check
|
||||
echo $status
|
||||
#CHECK: 0
|
||||
|
||||
echo -n '
|
||||
function hello_continuations
|
||||
echo cmd \
|
||||
echo --opt1 \
|
||||
echo --opt2 \
|
||||
echo --opt3
|
||||
end
|
||||
' | $fish_indent
|
||||
|
||||
#CHECK: function hello_continuations
|
||||
#CHECK: {{^}} echo cmd \
|
||||
#CHECK: {{^}} echo --opt1 \
|
||||
#CHECK: {{^}} echo --opt2 \
|
||||
#CHECK: {{^}} echo --opt3
|
||||
#CHECK: end
|
||||
|
||||
Reference in New Issue
Block a user