about summary refs log tree commit diff
path: root/src/string.rs
diff options
context:
space:
mode:
authorMarcus Klaas <mail@marcusklaas.nl>2015-09-11 00:52:16 +0200
committerMarcus Klaas <mail@marcusklaas.nl>2015-09-11 00:52:16 +0200
commitc680bb4030784ca15cc7d6c39caf297c9fb010e4 (patch)
tree5c8dc2d250f8b00fcf4bb3351395cb2d3f807ae1 /src/string.rs
parent1af301c33d1886a4e037f6ddb1ce495aa8d0573b (diff)
Implement basic chain formatting
Diffstat (limited to 'src/string.rs')
-rw-r--r--src/string.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/string.rs b/src/string.rs
index aba6a7f48da..5e5af61faf5 100644
--- a/src/string.rs
+++ b/src/string.rs
@@ -44,8 +44,8 @@ pub fn rewrite_string<'a>(s: &str, fmt: &StringFormat<'a>) -> String {
     result.push_str(fmt.opener);
 
     let ender_length = fmt.line_end.len();
-    let max_chars = fmt.width.checked_sub(fmt.opener.len()).unwrap_or(0)
-                             .checked_sub(ender_length).unwrap_or(1);
+    let max_chars = fmt.width.checked_sub(fmt.opener.len() + ender_length).unwrap_or(1);
+
     loop {
         let mut cur_end = cur_start + max_chars;