fix emoji support in autofmt

This commit is contained in:
Jonathan Kelley committed 2023-01-12 16:29:31 -08:00
1 parent fd4eac3488
commit cc8b910cf3
4 files changed
+48 -36

No files matched your search

+5 -2
View File
@@ -1,14 +1,17 @@
pub fn find_bracket_end(contents: &str) -> Option<usize> {
let mut depth = 0;
for (i, c) in contents.chars().enumerate() {
let mut len = 0;
for c in contents.chars() {
len += c.len_utf8();
if c == '{' {
depth += 1;
} else if c == '}' {
depth -= 1;
if depth == 0 {
return Some(i);
return Some(len);
}
}
}