Fix underflow when repeating a completion that has a negative shift position (#7322)

pull/7324/head
Philipp Mildenberger 1 year ago committed by GitHub
parent 25ad534d64
commit 2a11fb485d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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(),

Loading…
Cancel
Save