on master help sign in
Normalize line in picker preview to avoid crash
2d35b7bDmitry Sharshakov
helix-term/src/ui/picker.rs+1
@@ -124,6 +124,7 @@ impl<T: 'static> Component for FilePicker<T> {
124 }) {
124 }) {
125 // align to middle
125 // align to middle
126 let first_line = line
126 let first_line = line
127+ .map(|(s, e)| (s.min(doc.text().len_lines()), e.min(doc.text().len_lines())))
127 .map(|(start, _)| start)
128 .map(|(start, _)| start)
128 .unwrap_or(0)
129 .unwrap_or(0)
129 .saturating_sub(inner.height as usize / 2);
130 .saturating_sub(inner.height as usize / 2);