Simplified placeholder text logic

Co-authored-by: Andrii Dokhniak <adokhniak@gmail.com>
This commit is contained in:
afonsofrancof 2024-08-02 01:08:07 +01:00
parent 9e1cd25603
commit 5cddfdb162
No known key found for this signature in database

View File

@ -36,12 +36,8 @@ impl SearchBar {
pub fn draw(&self, frame: &mut Frame, area: Rect, state: &AppState) { pub fn draw(&self, frame: &mut Frame, area: Rect, state: &AppState) {
//Set the search bar text (If empty use the placeholder) //Set the search bar text (If empty use the placeholder)
let display_text = if self.search_input.is_empty() { let display_text = if !self.in_search_mode && self.search_input.is_empty() {
if self.in_search_mode { Span::raw("Press / to search")
Span::raw("")
} else {
Span::raw("Press / to search")
}
} else { } else {
Span::raw(&self.search_input) Span::raw(&self.search_input)
}; };