Skip to content

Commit

Permalink
Allow Doc to Display impl to use defined width
Browse files Browse the repository at this point in the history
  • Loading branch information
ysndr authored Mar 22, 2024
1 parent 9088f7f commit 12121c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod manpage;
mod splitter;

pub(crate) use self::console::Color;
use self::console::MAX_WIDTH;

#[cfg(feature = "docgen")]
pub use manpage::Section;
Expand Down Expand Up @@ -331,7 +332,8 @@ pub struct Doc {

impl std::fmt::Display for Doc {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.monochrome(true))
let width = f.width().unwrap_or(MAX_WIDTH);
f.write_str(&self.render_console(true, Color::Monochrome, width))
}
}

Expand Down

0 comments on commit 12121c0

Please sign in to comment.