feat(tui): search a room's log and members, and a conversation

A busy room's log scrolls past and its member list runs to a thousand
names, with nothing to narrow either. In a room / now filters the log
to lines mentioning the text and u filters the member list, the same
way the room list and the results filter: type, Enter keeps it, Esc
clears it before it leaves the room. The inbox takes / over the open
conversation. The member keys, b and m among them, act on the narrowed
list, and the titles say what is filtered and how many made it.
This commit is contained in:
Michel de Graaf
2026-09-08 11:24:53 +02:00
parent 6c4e60bb0e
commit 607532cc44
11 changed files with 325 additions and 43 deletions
+34
View File
@@ -190,6 +190,34 @@ impl MainTui {
return;
}
// Typing a filter captures the keys that edit it; the rest still
// move around.
if self.state.chat_filtering {
match key.code {
KeyCode::Esc => {
self.state.chat_filtering = false;
self.state.chat_filter.clear();
self.state.chat_view.to_newest();
return;
}
KeyCode::Enter => {
self.state.chat_filtering = false;
return;
}
KeyCode::Char(c) => {
self.state.chat_filter.push(c);
self.state.chat_view.to_newest();
return;
}
KeyCode::Backspace => {
self.state.chat_filter.pop();
self.state.chat_view.to_newest();
return;
}
_ => {}
}
}
// Paging keys move through the conversation's history.
if scroll_log(&mut self.state.chat_view, key) {
return;
@@ -199,9 +227,15 @@ impl MainTui {
}
match key.code {
// Esc peels back one level: a filter first, then the popup.
KeyCode::Esc if !self.state.chat_filter.is_empty() => {
self.state.chat_filter.clear();
self.state.chat_view.to_newest();
}
KeyCode::Char('i' | 'q') | KeyCode::Esc => {
self.state.show_messages = false;
}
KeyCode::Char('/') => self.state.chat_filtering = true,
// Move through the conversation list on the right.
KeyCode::Tab | KeyCode::Down | KeyCode::Char('j') => {
self.state.cycle_chat_peer(true);