From 61fd237b80ed17e9a765fb5d67f475067df4dcbb Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 18 Dec 2024 15:58:51 +0200 Subject: [PATCH] emit beep on search result is empty --- src/app/browser/window/tab/item/page/search/form.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/browser/window/tab/item/page/search/form.rs b/src/app/browser/window/tab/item/page/search/form.rs index eb1fa273..b9334628 100644 --- a/src/app/browser/window/tab/item/page/search/form.rs +++ b/src/app/browser/window/tab/item/page/search/form.rs @@ -11,8 +11,8 @@ use result::Result; use gtk::{ prelude::{ - BoxExt, ButtonExt, CheckButtonExt, EditableExt, EntryExt, TextBufferExt, TextViewExt, - WidgetExt, + BoxExt, ButtonExt, CheckButtonExt, DisplayExt, EditableExt, EntryExt, TextBufferExt, + TextViewExt, WidgetExt, }, Align, Box, Orientation, TextIter, TextSearchFlags, TextView, }; @@ -214,6 +214,11 @@ fn find(subject: &Subject, request: &str, is_match_case: bool) -> Vec<(TextIter, next = match_end; result.push((match_start, match_end)); } + + if result.is_empty() { + subject.text_view.display().beep() + } + result }