1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-09-07 16:05:50 +03:00

show 'match not found' error in search box title in editor example

Этот коммит содержится в:
rhysd
2022-07-08 12:08:38 +09:00
родитель dd409d6c4d
Коммит 5aa25ea24d

Просмотреть файл

@@ -266,7 +266,7 @@ impl<'a> Editor<'a> {
.. ..
} => { } => {
if !textarea.search_forward(false) { if !textarea.search_forward(false) {
self.message = Some("Pattern not found".into()); self.search.set_error(Some("Pattern not found"));
} }
} }
Input { Input {
@@ -280,13 +280,15 @@ impl<'a> Editor<'a> {
.. ..
} => { } => {
if !textarea.search_back(false) { if !textarea.search_back(false) {
self.message = Some("Pattern not found".into()); self.search.set_error(Some("Pattern not found"));
} }
} }
Input { Input {
key: Key::Enter, .. key: Key::Enter, ..
} => { } => {
textarea.search_forward(true); if !textarea.search_forward(true) {
self.message = Some("Pattern not found".into());
}
self.search.close(); self.search.close();
textarea.set_search_pattern("").unwrap(); textarea.set_search_pattern("").unwrap();
} }