From f005ec10fe1b6034c50f3a4ef24dd44d3e6d5593 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 29 Apr 2023 01:23:50 +0200 Subject: [PATCH] Fix editor panicking sometimes when hidden --- src/widgets/editor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/editor.rs b/src/widgets/editor.rs index 693a69f..3417ebe 100644 --- a/src/widgets/editor.rs +++ b/src/widgets/editor.rs @@ -412,7 +412,8 @@ impl Editor<'_> { // One extra column for cursor .map(|w| w.saturating_sub(1) as usize) .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 {