Skip to content

Commit

Permalink
fix(Help Wrapping): fixes a regression-bug where the old {n} newline …
Browse files Browse the repository at this point in the history
…char stopped working

As of this commit, one can use the old newline character `{n}` or the new `\n`

Closes #661
  • Loading branch information
kbknapp committed Sep 13, 2016
1 parent 804a60f commit 92ac353
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl<'a> Help<'a> {
let too_long = str_width(h) >= width;

debug!("Too long...");
if too_long {
if too_long || h.contains("{n}") {
sdebugln!("Yes");
help.push_str(h);
debugln!("help: {}", help);
Expand All @@ -380,11 +380,11 @@ impl<'a> Help<'a> {
help.push_str(h);
&*help
};
if help.contains("{n}") {
if let Some(part) = help.split("{n}").next() {
if help.contains("\n") {
if let Some(part) = help.split("\n").next() {
try!(write!(self.writer, "{}", part));
}
for part in help.split("{n}").skip(1) {
for part in help.split("\n").skip(1) {
try!(write!(self.writer, "\n{}", part));
}
} else {
Expand Down Expand Up @@ -432,7 +432,7 @@ impl<'a> Help<'a> {
}

debug!("Too long...");
if too_long && spcs <= width {
if too_long && spcs <= width || h.contains("{n}") {
sdebugln!("Yes");
help.push_str(h);
help.push_str(&*spec_vals);
Expand Down

0 comments on commit 92ac353

Please sign in to comment.