Normalize line in picker preview to avoid crash
This commit is contained in:
parent
b6c58ea23e
commit
2d35b7b99c
1 changed files with 1 additions and 0 deletions
|
@ -124,6 +124,7 @@ impl<T: 'static> Component for FilePicker<T> {
|
||||||
}) {
|
}) {
|
||||||
// align to middle
|
// align to middle
|
||||||
let first_line = line
|
let first_line = line
|
||||||
|
.map(|(s, e)| (s.min(doc.text().len_lines()), e.min(doc.text().len_lines())))
|
||||||
.map(|(start, _)| start)
|
.map(|(start, _)| start)
|
||||||
.unwrap_or(0)
|
.unwrap_or(0)
|
||||||
.saturating_sub(inner.height as usize / 2);
|
.saturating_sub(inner.height as usize / 2);
|
||||||
|
|
Loading…
Add table
Reference in a new issue