on master help sign in
Fix underflow when repeating a completion that has a negative shift position (#7322)
2a11fb4Philipp Mildenberger
helix-term/src/ui/editor.rs+3−2
@@ -907,8 +907,9 @@ impl EditorView {
907 let text = doc.text().slice(..);
907 let text = doc.text().slice(..);
908 let cursor = doc.selection(view.id).primary().cursor(text);
908 let cursor = doc.selection(view.id).primary().cursor(text);
909
909
910− let shift_position =
910+ let shift_position = |pos: usize| -> usize {
911− |pos: usize| -> usize { pos + cursor - trigger_offset };
911+ (pos + cursor).saturating_sub(trigger_offset)
912+ };
912
913
913 let tx = Transaction::change(
914 let tx = Transaction::change(
914 doc.text(),
915 doc.text(),