mirror of
https://github.com/helix-editor/helix.git
synced 2024-12-18 14:01:55 +04:00
Fix panic in kill_to_end_of_line
when handling multibyte characters (#12237)
This commit is contained in:
parent
617f538d41
commit
e14c346ee7
@ -233,15 +233,7 @@ fn eval_movement(&self, movement: Movement) -> usize {
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user