diff --git a/src/unindent.rs b/src/unindent.rs index 4dcc566..cec9200 100644 --- a/src/unindent.rs +++ b/src/unindent.rs @@ -5,7 +5,7 @@ pub fn unindent(text: &str) -> String { let mut start = 0; for (i, c) in text.char_indices() { if c == '\n' || i == text.len() - c.len_utf8() { - let end = i + 1; + let end = i + c.len_utf8(); lines.push(&text[start..end]); start = end; } diff --git a/tests/lib.rs b/tests/lib.rs index f507679..0827bba 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -57,6 +57,7 @@ mod invocation_directory; mod json; mod line_prefixes; mod misc; +mod multibyte_char; mod positional_arguments; mod quiet; mod quote; diff --git a/tests/multibyte_char.rs b/tests/multibyte_char.rs new file mode 100644 index 0000000..2d65831 --- /dev/null +++ b/tests/multibyte_char.rs @@ -0,0 +1,6 @@ +use super::*; + +#[test] +fn bugfix() { + Test::new().justfile("foo:\nx := '''ǩ'''").run(); +}