From 810524325e5d0608c1586c8a118c44c3583a2bf8 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 13 Apr 2023 02:18:32 +0200 Subject: [PATCH] Fix hidden placeholder appearing in empty editor --- src/widgets/editor.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/widgets/editor.rs b/src/widgets/editor.rs index 8b4d91d..5a7da70 100644 --- a/src/widgets/editor.rs +++ b/src/widgets/editor.rs @@ -417,7 +417,10 @@ impl Editor<'_> { } fn rows(&self, indices: &[usize]) -> Vec { - let text = self.hidden.as_ref().unwrap_or(&self.highlighted); + let text = match self.hidden.as_ref() { + Some(hidden) if !self.highlighted.text().is_empty() => hidden, + _ => &self.highlighted, + }; text.clone().split_at_indices(indices) }