fish_indent: Don't panic for gap text

It should be fine to just write the space out here.

This one triggered by `echo b\|\{ | ./fish_indent`
This commit is contained in:
Fabian Boehm 2024-01-10 19:33:47 +01:00
parent ed251578d1
commit 445406d251

View File

@ -446,8 +446,9 @@ impl<'source, 'ast> PrettyPrinterState<'source, 'ast> {
self.emit_newline();
}
} else {
panic!("Gap text should only have comments and newlines - instead found token type {:?} with text: {}",
tok.type_, tok_text);
// Anything else we write a space.
self.emit_space_or_indent(GapFlags::default());
self.output.push_utfstr(tok_text);
}
}
if needs_nl {