1
0
mirror of https://github.com/casey/just synced 2024-07-01 07:24:45 +00:00

Fix multibyte codepoint crash (#1243)

Co-authored-by: Evan Richter <evanjrichter@gmail.com>
This commit is contained in:
Casey Rodarmor 2022-06-20 17:24:13 -07:00 committed by GitHub
parent 691b3dcf56
commit c625d61abd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -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;
}

View File

@ -57,6 +57,7 @@ mod invocation_directory;
mod json;
mod line_prefixes;
mod misc;
mod multibyte_char;
mod positional_arguments;
mod quiet;
mod quote;

6
tests/multibyte_char.rs Normal file
View File

@ -0,0 +1,6 @@
use super::*;
#[test]
fn bugfix() {
Test::new().justfile("foo:\nx := '''ǩ'''").run();
}