From 5aa25ea24d3229d9afd5bbfcf4a688ede8d088da Mon Sep 17 00:00:00 2001 From: rhysd Date: Fri, 8 Jul 2022 12:08:38 +0900 Subject: [PATCH] show 'match not found' error in search box title in editor example --- examples/editor.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/editor.rs b/examples/editor.rs index a12099a..f17d51f 100644 --- a/examples/editor.rs +++ b/examples/editor.rs @@ -266,7 +266,7 @@ impl<'a> Editor<'a> { .. } => { if !textarea.search_forward(false) { - self.message = Some("Pattern not found".into()); + self.search.set_error(Some("Pattern not found")); } } Input { @@ -280,13 +280,15 @@ impl<'a> Editor<'a> { .. } => { if !textarea.search_back(false) { - self.message = Some("Pattern not found".into()); + self.search.set_error(Some("Pattern not found")); } } Input { key: Key::Enter, .. } => { - textarea.search_forward(true); + if !textarea.search_forward(true) { + self.message = Some("Pattern not found".into()); + } self.search.close(); textarea.set_search_pattern("").unwrap(); }