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 Triton171 committed Jun 18, 2023
1 parent 9e294dc commit c6e082d
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 @@ -907,8 +907,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 c6e082d

Please sign in to comment.