We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c2181be commit ffa542aCopy full SHA for ffa542a
1 file changed
src/print/unicode.rs
@@ -232,17 +232,18 @@ fn create_wrapping_options<'a>(
232
} else if atty::is(atty::Stream::Stdout) {
233
let width = crossterm::terminal::size()
234
.map_err(|err| err.to_string())?
235
- .0;
236
- let width = if width as usize > graph_width {
237
- width as usize - graph_width
+ .0 as usize;
+ let text_width = width.saturating_sub(graph_width);
+ if text_width < 40 {
238
+ // If too little space left for text, do not wrap at all
239
+ None
240
} else {
- 1
- };
241
- Some(
242
- textwrap::Options::new(width)
243
- .initial_indent(indent1)
244
- .subsequent_indent(indent2),
245
- )
+ Some(
+ textwrap::Options::new(text_width)
+ .initial_indent(indent1)
+ .subsequent_indent(indent2),
+ )
246
+ }
247
248
None
249
};
0 commit comments