From 4f9a194cd37f01ee78d44fe3030f5cdabc2d2119 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 25 Sep 2024 09:42:02 -0400 Subject: [PATCH] suggester: Adjust swap_idx in move_char_suggest to be absolute --- src/suggester.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/suggester.rs b/src/suggester.rs index 909b0f8..db98381 100644 --- a/src/suggester.rs +++ b/src/suggester.rs @@ -532,7 +532,7 @@ impl<'a, S: BuildHasher> Suggester<'a, S> { if remaining_attempts == 0 { unsafe { let bytes = buffer.as_bytes_mut(); - bytes[idx1..swap_idx].rotate_right(ch1.len_utf8()); + bytes[idx1..swap_idx + idx2].rotate_right(ch1.len_utf8()); } debug_assert_eq!(word, &*buffer); return;