From e14c346ee74a44051b2c07c2255a6ab80142dbe7 Mon Sep 17 00:00:00 2001 From: Takumi Matsuura Date: Sat, 14 Dec 2024 05:04:52 +0900 Subject: [PATCH] Fix panic in `kill_to_end_of_line` when handling multibyte characters (#12237) --- helix-term/src/ui/prompt.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 1e443ce7ff0e..8c7a7bafaf2d 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -233,15 +233,7 @@ impl Prompt { position } Movement::StartOfLine => 0, - Movement::EndOfLine => { - let mut cursor = - GraphemeCursor::new(self.line.len().saturating_sub(1), self.line.len(), false); - if let Ok(Some(pos)) = cursor.next_boundary(&self.line, 0) { - pos - } else { - self.cursor - } - } + Movement::EndOfLine => self.line.len(), Movement::None => self.cursor, } }