on master help sign in
Fix underflow when repeating a completion that has a negative shift position (#7322)
commit2a11fb485d33eb33a7743899e9a86f745f6d5e02 authorPhilipp Mildenberger <philipp@mildenberger.me> dateMon 12 Jun 2023, 18:37 (3 years ago) parent25ad534
1 file changed+3−2
helix-term/src/ui/editor.rs+3−2
helix-term/src/ui/editor.rs+3−2
@@ -907,8 +907,9 @@ impl EditorView {
907907 let text = doc.text().slice(..);
908908 let cursor = doc.selection(view.id).primary().cursor(text);
909909
910− let shift_position =
911− |pos: usize| -> usize { pos + cursor - trigger_offset };
910+ let shift_position = |pos: usize| -> usize {
911+ (pos + cursor).saturating_sub(trigger_offset)
912+ };
912913
913914 let tx = Transaction::change(
914915 doc.text(),