Skip to content

Commit

Permalink
Fix crash when jumping to the end of the line.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenchou committed Jun 15, 2024
1 parent 7f6438c commit f5ca810
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions termwiz/src/lineedit/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,7 @@ impl LineEditBuffer {
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,
}
}
Expand Down

0 comments on commit f5ca810

Please sign in to comment.