mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
fish_indent: Another crash
NUL at the end, which is now ignored. Not *great*, but better than crashing.
This commit is contained in:
parent
50acc4f4de
commit
2e14c32c5e
2 changed files with 5 additions and 2 deletions
|
@ -647,11 +647,11 @@ impl<'source, 'ast> PrettyPrinterState<'source, 'ast> {
|
||||||
// # something
|
// # something
|
||||||
// cmd2
|
// cmd2
|
||||||
// Treat it as gap text.
|
// Treat it as gap text.
|
||||||
if node.range().unwrap().length() == 0 {
|
let Some(range) = node.range() else { return; };
|
||||||
|
if range.length() == 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let flags = self.gap_text_flags_before_node(node);
|
let flags = self.gap_text_flags_before_node(node);
|
||||||
let range = node.range().unwrap();
|
|
||||||
self.current_indent = self.indent(range.start());
|
self.current_indent = self.indent(range.start());
|
||||||
let added_newline = self.emit_gap_text_before(range, flags);
|
let added_newline = self.emit_gap_text_before(range, flags);
|
||||||
let mut gap_range = range;
|
let mut gap_range = range;
|
||||||
|
|
|
@ -446,3 +446,6 @@ echo b\|\{ | $fish_indent
|
||||||
|
|
||||||
echo "\'\\\\\x00\'" | string unescape | $fish_indent | string escape
|
echo "\'\\\\\x00\'" | string unescape | $fish_indent | string escape
|
||||||
# CHECK: \'\\\x00\'
|
# CHECK: \'\\\x00\'
|
||||||
|
|
||||||
|
echo '\"\"\|\x00' | string unescape | $fish_indent | string unescape
|
||||||
|
# CHECK: |
|
||||||
|
|
Loading…
Reference in a new issue