Skip to content

Add focus-aware bottom status bar - #17

Merged
KinseyD merged 9 commits into
mainfrom
feat/status-bar
Oct 27, 2026
Merged

KinseyD merged 9 commits into
mainfrom
feat/status-bar

Conversation

@KinseyD

@KinseyD KinseyD commented Oct 23, 2026

Copy link
Copy Markdown
Owner

What

A one-line status bar on the terminal's very bottom row (below the composer and its gap) showing three segments for the currently focused buffer:

 server osu_irc │ channel #osu │ type in

The segment matching where the user's effective focus is gets highlighted (bold, on the new status_bar_highlight background). Clicking a segment moves focus to that zone.

Focus-zone mapping

The codebase has three focus zones (Focus in src/tui/view.rs: Sidebar / Messages / Composer); the sidebar covers both server and buffer navigation, so the mapping is:

Effective focus Highlighted segment
Focus::Composer type in (input)
Focus::Messages channel (the pane shows the active buffer's stream)
Focus::Sidebar, cursor on a server header row server
Focus::Sidebar, cursor on a channel/query row channel
Sidebar focused but empty (fresh start) server (fallback)

Segment contents

Label + value was chosen over values alone (clearer at a glance, and it makes the i18n labels visible): server <label>, channel <name> (#chan, @nick, or the localized console label while a server console is viewed), and the standing type in label for the input zone. Names are data; labels are translatable. Before anything is connected both value segments show a localized not connected placeholder. On narrow terminals the two value segments shrink (wider one first) and ellipsize by unicode display width; on a 1-row terminal the bar yields its row to the composer.

i18n keys added (statusbar.*, en / zh-CN)

Key English zh-CN
statusbar.server server {name} 服务器 {name}
statusbar.channel channel {name} 频道 {name}
statusbar.input type in 输入
statusbar.console console 控制台
statusbar.none not connected 未连接

Theme role added

status_bar_highlight — background of the focused status-bar segment (default #9ad99a, same as the accent). Documented in config.example.toml and the README [theme] section.

Test coverage (all sync #[test], TestBackend where rendering)

  • status_bar_renders_three_segments_on_the_bottom_row — bar at the bottom row, nothing above.
  • focused_composer_highlights_the_status_bar_input_segment — styled-cell assertions (highlight bg/fg/bold on the input segment, dim on the rest, │ separators).
  • sidebar_navigation_highlights_the_selected_zone_segment — server header vs channel row cursor.
  • status_bar_zone_hit_testing_matches_the_painted_segments — column→zone mapping used by mouse routing.
  • status_bar_shows_placeholders_before_anything_is_connected — empty state.
  • status_bar_survives_tiny_terminals_without_panicking — 0..12 × 0..4 grid, no crash.
  • status_zone_follows_focus_and_the_sidebar_cursor_row_kind, status_bar_zone_focus_shortcuts_target_the_matching_sidebar_row (view) and status_bar_segment_clicks_focus_their_zones (events) — mapping + click routing.
  • Mouse geometry: the_bottom_row_maps_to_the_status_bar_on_every_column, updated rows_below_the_composer_are_none_except_the_status_bar.

Existing geometry-pinned tests were updated for the one-row-shorter content area (composer/gap rows shift up by one).

A one-line status bar on the terminal's bottom row shows three segments
for the focused buffer: 'server <name> | channel <name> | type in'.
The segment matching the effective focus is highlighted:

- Composer focus highlights the input segment.
- Message-pane focus highlights the channel segment (it shows the
  active buffer's stream).
- Sidebar focus highlights whichever row the cursor is on: a server
  header lights the server segment, a channel/query row the channel
  segment.

Clicking a segment focuses its zone (sidebar header row, sidebar buffer
row, or the composer). Segments ellipsize via unicode display width on
narrow terminals; before anything is connected the value segments show
a localized placeholder. On a 1-row terminal the bar yields its row to
the composer.

New: statusbar.* i18n keys (en + zh-CN) and the status_bar_highlight
theme role.
The 10s fixed windows widened in v0.7.0 proved insufficient: CI run
39920909588 (macOS) failed the wire capture at the JOIN #runtime
assertion - the worker wrote the JOIN only after the wire barrier's
PING - and one fixed 10s event window can likewise expire on a
momentary runner stall.

Replace the single-shot waits in
join_failures_keep_intent_and_route_once_only_for_known_channels with
bounded polling (per-file SLOW_WAIT = 30s cap, 200ms poll slices):

- wire_until: captures fresh barrier windows until one equals the
  expected lines, so a JOIN landing just after a barrier is caught by
  the next window.
- sync_events_polling: one outstanding event barrier received through
  short recv_timeout slices until it arrives.
- read_line_soft: read_line_until without the deadline panic, so a
  timed-out window retries instead of failing.

Both fail only when the cap expires.
A block with no applicable value now hides entirely instead of
rendering a placeholder: with nothing connected only the standing
'type in' block remains, and a server console view drops the channel
block (the server block already names it). The dead statusbar.none
and statusbar.console keys are removed from the registry, zh-CN
locale, and the pinned-literal test.

Each block's right edge is now a powerline-style right-pointing
triangle, so consecutive blocks nest arrow-to-tail: the arrow is the
block's own fill color on the background of whatever follows (the
next block's or the screen's), so a highlighted block's arrow reads
as part of it. All colors derive from existing roles (dim,
global_bg, status_bar_highlight) - no new theme role is needed.
Arrows are part of their block's hit range, so clicking one focuses
that block's zone; hidden blocks have no clickable range.
U+25B6 leaves gaps above and below in most fonts. Swap it for the
powerline right-pointing triangle U+E0B0 (Nerd Fonts), which is drawn
to fill the whole cell, so the separator spans the status bar's full
row height. It stays one column wide and part of its block's hit
range.

Color rule unchanged and re-verified: the arrow's foreground is the
current block's fill (status_bar_highlight when highlighted, else
dim), its background is the block to the right (that block's fill
when highlighted, else global_bg), and plain global_bg for the last
arrow with no block to its right.

README and CHANGELOG note the Nerd Fonts origin and the fallback
behaviour without one.
The arrow's foreground now follows the current block's background, not
its text color: status_bar_highlight on a highlighted block, global_bg
on a plain one. Its background stays the following block's background
(global_bg when there is none).

Powerline semantics follow: a plain-on-plain divider blends into the
global background, and the arrow only becomes visible where a colored
(highlighted) block follows it. No new role or invented divider color
is used.
Blocks to the right of the highlighted zone's block now hide, so the
highlighted block is always the last one rendered and its arrow sits
on the global background: server focus keeps only the server block,
channel focus adds the channel block, input focus shows all three.
The message pane of a server console highlights the server zone
(there is no channel block to light), and hit-testing derives from
the painted blocks, so hidden blocks' columns turn into dead space.

Startup focus was wrong: App::new defaulted to the sidebar with its
cursor on the first row, so the first frame highlighted the server
zone instead of the composer where typing lands. The composer now
holds focus from the first frame (keys type immediately; Tab or a
click moves to the sidebar), which also keeps the nothing-connected
bar at ' type in ' highlighted from the first render.
Two related fixes:

status_zone() can name a zone whose block is absent from the block
list - a console view hides the channel block, and before anything
is connected both value blocks hide - so the rank-based truncation
kept a list with no highlighted block (a lone dimmed server block,
or a fully blank bar when the server zone had no block at all).
effective_status_zone() now resolves the highlight against the block
list: the named zone when its block exists, otherwise the last
present block's zone, so the highlighted block always exists and is
always the last one rendered. fit_status_bar and render_status_bar
share it; hit-testing keeps deriving from the painted blocks.

The server and channel blocks now show the raw names only - no
'server'/'channel' label prefix - so the dead statusbar.server and
statusbar.channel templates are removed from the registry, zh-CN
locale, and the pin test (statusbar.input remains; the input block
has no value of its own). Value blocks with an empty name hide like
any other value-less block.
@KinseyD
KinseyD merged commit f88f156 into main Oct 27, 2026
5 checks passed
@KinseyD
KinseyD deleted the feat/status-bar branch November 8, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant