Fix underflow when repeating a completion that has a negative shift position (#7322)
This commit is contained in:
parent
25ad534d64
commit
2a11fb485d
1 changed files with 3 additions and 2 deletions
|
@ -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…
Reference in a new issue