emit beep on search result is empty

This commit is contained in:
yggverse 2024-12-18 15:58:51 +02:00
parent 320a97f9fb
commit 61fd237b80

View File

@ -11,8 +11,8 @@ use result::Result;
use gtk::{ use gtk::{
prelude::{ prelude::{
BoxExt, ButtonExt, CheckButtonExt, EditableExt, EntryExt, TextBufferExt, TextViewExt, BoxExt, ButtonExt, CheckButtonExt, DisplayExt, EditableExt, EntryExt, TextBufferExt,
WidgetExt, TextViewExt, WidgetExt,
}, },
Align, Box, Orientation, TextIter, TextSearchFlags, TextView, 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; next = match_end;
result.push((match_start, match_end)); result.push((match_start, match_end));
} }
if result.is_empty() {
subject.text_view.display().beep()
}
result result
} }