Fix editor panicking sometimes when hidden

This commit is contained in:
Joscha 2023-04-29 01:23:50 +02:00
parent 8bfb4b2dc3
commit f005ec10fe

View file

@ -412,7 +412,8 @@ impl Editor<'_> {
// One extra column for cursor // One extra column for cursor
.map(|w| w.saturating_sub(1) as usize) .map(|w| w.saturating_sub(1) as usize)
.unwrap_or(usize::MAX); .unwrap_or(usize::MAX);
wrap(widthdb, self.state.text(), max_width) let text = self.hidden.as_ref().unwrap_or(&self.highlighted);
wrap(widthdb, text.text(), max_width)
} }
fn rows(&self, indices: &[usize]) -> Vec<Styled> { fn rows(&self, indices: &[usize]) -> Vec<Styled> {