mirror of https://github.com/zkat/miette.git
fix(report): fix wrapping for header and add wrapping for footer
This commit is contained in:
parent
eaebde92cf
commit
eb07d5bd66
|
|
@ -126,11 +126,11 @@ impl GraphicalReportHandler {
|
||||||
f,
|
f,
|
||||||
"{}{}",
|
"{}{}",
|
||||||
header,
|
header,
|
||||||
self.theme
|
self.theme.characters.hbar.to_string().repeat(
|
||||||
.characters
|
self.termwidth
|
||||||
.hbar
|
.saturating_sub(width)
|
||||||
.to_string()
|
.saturating_sub("Error: ".len())
|
||||||
.repeat(self.termwidth.saturating_sub(width)),
|
),
|
||||||
)?;
|
)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -182,7 +182,12 @@ impl GraphicalReportHandler {
|
||||||
if let Some(help) = diagnostic.help() {
|
if let Some(help) = diagnostic.help() {
|
||||||
let help = help.style(self.theme.styles.help);
|
let help = help.style(self.theme.styles.help);
|
||||||
writeln!(f)?;
|
writeln!(f)?;
|
||||||
writeln!(f, " {} {}", self.theme.characters.fyi, help)?;
|
let width = self.termwidth.saturating_sub(4);
|
||||||
|
let initial_indent = format!(" {} ", self.theme.characters.fyi);
|
||||||
|
let opts = textwrap::Options::new(width)
|
||||||
|
.initial_indent(&initial_indent)
|
||||||
|
.subsequent_indent(" ");
|
||||||
|
writeln!(f, "{}", textwrap::fill(&help.to_string(), opts))?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue