Skip to content

Commit

Permalink
feat(Help): adds new short hand way to use source formatting and igno…
Browse files Browse the repository at this point in the history
…re term width in help messages

Prior to this commit if one wished to use source formatting and ignore
term width they could do `App::set_term_width(usize::MAX)` now one can
also use `App::set_term_width(0)` which does the same thing.

Closes #625
  • Loading branch information
kbknapp committed Aug 24, 2016
1 parent 0bda63a commit 7dfdaf2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::io::{self, Cursor, Read, Write};
use std::collections::BTreeMap;
use std::fmt::Display;
use std::cmp;
use std::usize;

use vec_map::VecMap;

Expand Down Expand Up @@ -102,7 +103,11 @@ impl<'a> Help<'a> {
next_line_help: next_line_help,
hide_pv: hide_pv,
term_w: match term_w {
Some(width) => width,
Some(width) => if width == 0 {
usize::MAX
} else {
width
},
None => term_size::dimensions().map_or(120, |(w, _)| w),
},
color: color,
Expand Down

0 comments on commit 7dfdaf2

Please sign in to comment.