Fix excess missed markers in non-Latin text
This commit is contained in:
parent
0f86c9fd11
commit
0be31b1b17
@ -72,7 +72,7 @@ impl DiffContext {
|
||||
}
|
||||
"insert" => {
|
||||
let expected_str = self.slice_expected(&opcode);
|
||||
provided.push(DiffToken::missing("-".repeat(expected_str.len())));
|
||||
provided.push(DiffToken::missing("-".repeat(expected_str.chars().count())));
|
||||
expected.push(DiffToken::missing(expected_str));
|
||||
}
|
||||
"replace" => {
|
||||
@ -248,6 +248,15 @@ mod test {
|
||||
assert_eq!(ctx.to_tokens().provided, &[good("1"), missing("-"),]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missed_chars_counted_correctly() {
|
||||
let ctx = DiffContext::new("нос", "нс");
|
||||
assert_eq!(
|
||||
ctx.to_tokens().provided,
|
||||
&[good("н"), missing("-"), good("с")]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn handles_certain_unicode_as_expected() {
|
||||
// this was not parsed as expected with dissimilar 1.0.4
|
||||
|
Loading…
Reference in New Issue
Block a user