Fix deleting word from end of buffer (#4328)

This commit is contained in:
Jonathan LEI 2022-10-19 08:53:58 +08:00 committed by GitHub
parent 0c14d9f869
commit 1a772d1b67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2885,7 +2885,7 @@ pub mod insert {
/// Exclude the cursor in range.
fn exclude_cursor(text: RopeSlice, range: Range, cursor: Range) -> Range {
if range.to() == cursor.to() {
if range.to() == cursor.to() && text.len_chars() != cursor.to() {
Range::new(
range.from(),
graphemes::prev_grapheme_boundary(text, cursor.to()),