diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2017-02-21 14:43:43 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2017-02-21 16:35:05 +1300 |
| commit | b35906dbce47552c2ba6350f31c654bc77603fbd (patch) | |
| tree | 793818f31eff2b6083cc391b2aa227293a0e837f /src/string.rs | |
| parent | 4f939ddf0c9344da646367d46810eb1ac92c5780 (diff) | |
WIP
Diffstat (limited to 'src/string.rs')
| -rw-r--r-- | src/string.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/string.rs b/src/string.rs index 014830a9155..7fd6bb78e61 100644 --- a/src/string.rs +++ b/src/string.rs @@ -36,7 +36,8 @@ pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option<String> let stripped_str = re.replace_all(orig, "$1"); let graphemes = UnicodeSegmentation::graphemes(&*stripped_str, false).collect::<Vec<&str>>(); - let indent = fmt.shape.indent.to_string(fmt.config); + let shape = fmt.shape.visual_indent(0); + let indent = shape.indent.to_string(fmt.config); let punctuation = ":,;."; // `cur_start` is the position in `orig` of the start of the current line. @@ -49,7 +50,7 @@ pub fn rewrite_string<'a>(orig: &str, fmt: &StringFormat<'a>) -> Option<String> let ender_length = fmt.line_end.len(); // If we cannot put at least a single character per line, the rewrite won't // succeed. - let max_chars = try_opt!(fmt.shape.width.checked_sub(fmt.opener.len() + ender_length + 1)) + 1; + let max_chars = try_opt!(shape.width.checked_sub(fmt.opener.len() + ender_length + 1)) + 1; // Snip a line at a time from `orig` until it is used up. Push the snippet // onto result. |
