Fix search stability and improve Escape key behavior

- Add bounds check in _mark_message_as_read to prevent IndexError
- Clear metadata_by_id when search returns no results
- Escape now focuses search input when in search mode instead of exiting
- Add focus_input() method to SearchPanel
This commit is contained in:
Bendt
2025-12-19 15:10:50 -05:00
parent 807736f808
commit 5deebbbf98
2 changed files with 19 additions and 21 deletions

View File

@@ -216,6 +216,11 @@ class SearchPanel(Widget):
self._cancel_debounce()
self.result_count = -1
def focus_input(self) -> None:
"""Focus the search input field."""
input_widget = self.query_one("#search-input", Input)
input_widget.focus()
@property
def is_visible(self) -> bool:
"""Check if the panel is visible."""