Skip to content

Commit cb085fc

Browse files
committed
Merge pull request #758 from cassiersg/issue-717
Fix issue with windows line endings (#717).
2 parents 66abad9 + 598fcdd commit cb085fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ pub fn fmt_lines(file_map: &mut FileMap, config: &Config) -> FormatReport {
337337

338338
for (c, b) in text.chars() {
339339
if c == '\r' {
340+
line_len += c.len_utf8();
340341
continue;
341342
}
342343

@@ -367,7 +368,7 @@ pub fn fmt_lines(file_map: &mut FileMap, config: &Config) -> FormatReport {
367368
last_wspace = None;
368369
} else {
369370
newline_count = 0;
370-
line_len += 1;
371+
line_len += c.len_utf8();
371372
if c.is_whitespace() {
372373
if last_wspace.is_none() {
373374
last_wspace = Some(b);

0 commit comments

Comments
 (0)