From 92ac353b48b7caa2511ad2a046d94da93c236cf6 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Mon, 12 Sep 2016 23:19:26 -0400 Subject: [PATCH] fix(Help Wrapping): fixes a regression-bug where the old {n} newline char stopped working As of this commit, one can use the old newline character `{n}` or the new `\n` Closes #661 --- src/app/help.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/help.rs b/src/app/help.rs index 16312bf0..dc07944a 100644 --- a/src/app/help.rs +++ b/src/app/help.rs @@ -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); @@ -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 { @@ -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);