Skip to content

Commit 38536c9

Browse files
authored
fix: fix formating crash caused by non-breaking space in comment. (#10522)
fix: fix formating crash caused by non-breaking space in comment
1 parent 776897b commit 38536c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/fmt/src/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<W: Write> FormatBuffer<W> {
181181
.take(self.base_indent_len)
182182
.take_while(|(_, _, ch)| ch.is_whitespace())
183183
.last()
184-
.map(|(state, idx, _)| (state, idx + 1))
184+
.map(|(state, idx, ch)| (state, idx + ch.len_utf8()))
185185
.unwrap_or((comment_state, 0));
186186
comment_state = new_comment_state;
187187
let trimmed_line = &line[line_start..];

0 commit comments

Comments
 (0)