refactor(tui): fold the keys overlay onto LogView and dedupe the pane lookups
The keys overlay scrolled with its own counter, a fixed page of ten and a usize::MAX sentinel that the renderer clamped back; it now reads through the same LogView as the chat and room logs, so the page is the window it last drew and the half-page keys work there too. One pane_area lookup and one page_of helper replace the pane-to-area match that page_size, highlighted_name_end and the mouse hit test each repeated, and list_jump takes its page as a usize so the callers stop converting. The pane number keys are one range arm over FocusedPane::ALL, whose index is the declaration order. The row layout carries each pane's weight beside it instead of re-matching with an unreachable arm, and the help columns are measured from the lines already built rather than built again for their width. The shortcut legend borrows its static keys instead of allocating three strings per entry per frame.
This commit is contained in:
@@ -110,10 +110,14 @@ fn render_chat(frame: &mut Frame, area: Rect, rooms: &mut RoomsState) {
|
||||
|
||||
render_tab_bar(frame, chunks[0], rooms);
|
||||
|
||||
let user_selected = rooms.user_selected;
|
||||
let composing = rooms.composing;
|
||||
let active_index = rooms.active;
|
||||
let Some(active) = rooms.open.get_mut(active_index) else {
|
||||
let RoomsState {
|
||||
open,
|
||||
active: active_index,
|
||||
user_selected,
|
||||
composing,
|
||||
..
|
||||
} = rooms;
|
||||
let Some(active) = open.get_mut(*active_index) else {
|
||||
frame.render_widget(
|
||||
Paragraph::new("No open rooms. Press l for the room list.")
|
||||
.style(dimmed_style()),
|
||||
@@ -128,10 +132,10 @@ fn render_chat(frame: &mut Frame, area: Rect, rooms: &mut RoomsState) {
|
||||
.split(chunks[1]);
|
||||
|
||||
render_messages(frame, body[0], active.lines.as_slice(), &mut active.view);
|
||||
render_users(frame, body[1], &active.users, user_selected);
|
||||
render_users(frame, body[1], &active.users, *user_selected);
|
||||
|
||||
// Compose line or hint.
|
||||
if composing {
|
||||
if *composing {
|
||||
let line = Line::from(vec![
|
||||
Span::styled("› ", accent_style()),
|
||||
Span::styled(active.input.clone(), primary_style()),
|
||||
|
||||
Reference in New Issue
Block a user