Skip to content

Commit

Permalink
Revert "Fix crash when jumping to the end of the line."
Browse files Browse the repository at this point in the history
This reverts commit f5ca810.
  • Loading branch information
kenchou committed Jun 15, 2024
1 parent f5ca810 commit 76ce9b6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion termwiz/src/lineedit/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@ impl LineEditBuffer {
position
}
Movement::StartOfLine => 0,
Movement::EndOfLine => self.line.len(),
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::None => self.cursor,
}
}
Expand Down

0 comments on commit 76ce9b6

Please sign in to comment.