Skip to content

Commit

Permalink
Fix underflow when repeating a completion that has a negative shift p…
Browse files Browse the repository at this point in the history
…osition (helix-editor#7322)
  • Loading branch information
Philipp-M authored and wes-adams committed Jul 3, 2023
1 parent 4b93777 commit 1c60197
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,9 @@ impl EditorView {
let text = doc.text().slice(..);
let cursor = doc.selection(view.id).primary().cursor(text);

let shift_position =
|pos: usize| -> usize { pos + cursor - trigger_offset };
let shift_position = |pos: usize| -> usize {
(pos + cursor).saturating_sub(trigger_offset)
};

let tx = Transaction::change(
doc.text(),
Expand Down

0 comments on commit 1c60197

Please sign in to comment.