From 2d35b7b99cc903bc254e9e98979b7638c16d0e7a Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Sun, 5 Sep 2021 14:31:16 +0300 Subject: Normalize line in picker preview to avoid crash --- helix-term/src/ui/picker.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'helix-term') diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 090ba242..84b8dd72 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -124,6 +124,7 @@ impl Component for FilePicker { }) { // align to middle let first_line = line + .map(|(s, e)| (s.min(doc.text().len_lines()), e.min(doc.text().len_lines()))) .map(|(start, _)| start) .unwrap_or(0) .saturating_sub(inner.height as usize / 2); -- cgit v1.2.3-70-g09d2