mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
parent
2e948d9d6d
commit
a21db45cee
3 changed files with 24 additions and 3 deletions
|
@ -84,10 +84,11 @@ static void prettify_node_recursive(const wcstring &source, const parse_node_tre
|
|||
const parse_node_t &node = tree.at(node_idx);
|
||||
const parse_token_type_t node_type = node.type;
|
||||
|
||||
/* Increment the indent if we are either a root job_list, or root case_item_list */
|
||||
/* Increment the indent if we are either a root job_list, or root case_item_list, or in an if or while header (#1665) */
|
||||
const bool is_root_job_list = (node_type == symbol_job_list && parent_type != symbol_job_list);
|
||||
const bool is_root_case_item_list = (node_type == symbol_case_item_list && parent_type != symbol_case_item_list);
|
||||
if (is_root_job_list || is_root_case_item_list)
|
||||
const bool is_if_while_header = (node_type == symbol_job && (parent_type == symbol_if_clause || parent_type == symbol_while_header));
|
||||
if (is_root_job_list || is_root_case_item_list || is_if_while_header)
|
||||
{
|
||||
node_indent += 1;
|
||||
}
|
||||
|
|
|
@ -75,4 +75,11 @@ echo hi
|
|||
else
|
||||
echo bye
|
||||
end; echo alpha "
|
||||
' | ../fish_indent
|
||||
' | ../fish_indent
|
||||
|
||||
echo \nTest7
|
||||
# issue 1665
|
||||
echo -n '
|
||||
if begin ; false; end; echo hi ; end
|
||||
while begin ; false; end; echo hi ; end
|
||||
' | ../fish_indent
|
||||
|
|
|
@ -78,3 +78,16 @@ else
|
|||
echo bye
|
||||
end
|
||||
echo alpha "
|
||||
|
||||
Test7
|
||||
|
||||
if begin
|
||||
false
|
||||
end
|
||||
echo hi
|
||||
end
|
||||
while begin
|
||||
false
|
||||
end
|
||||
echo hi
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue