Skip to main content

codetether_agent/tui/ui/chat_view/
status_hints.rs

1//! Keybinding hint spans for the status bar.
2
3use ratatui::{
4    style::{Color, Style},
5    text::Span,
6};
7
8/// Build the CHAT banner and keybinding hint spans.
9///
10/// # Examples
11///
12/// ```rust
13/// use codetether_agent::tui::ui::chat_view::status_hints::header_spans;
14/// let spans = header_spans("abc");
15/// let text: String = spans.iter().map(|s| s.content.as_ref()).collect();
16/// assert!(text.contains("CHAT"));
17/// ```
18pub fn header_spans(session_label: &str) -> Vec<Span<'static>> {
19    vec![
20        Span::styled(" CHAT ", Style::default().fg(Color::Black).bg(Color::Cyan)),
21        Span::raw(" | "),
22        kb("?"),
23        Span::raw(": Help | "),
24        kb("Tab"),
25        Span::raw(": Complete | "),
26        kb("↑↓"),
27        Span::raw(": Scroll | "),
28        kb("Shift+↑↓"),
29        Span::raw(": Tools | "),
30        kb("Ctrl+↑↓"),
31        Span::raw(": History | "),
32        kb("Ctrl+T"),
33        Span::raw(": Symbols | "),
34        kb("Esc"),
35        Span::raw(": Back | "),
36        kb("Ctrl+C"),
37        Span::raw(": Quit | "),
38        Span::styled("session", Style::default().fg(Color::DarkGray)),
39        Span::raw(": "),
40        Span::styled(session_label.to_string(), Style::default().fg(Color::Cyan)),
41        Span::raw(" | "),
42    ]
43}
44
45/// Style a keyboard shortcut key in yellow.
46fn kb(key: &str) -> Span<'static> {
47    Span::styled(key.to_string(), Style::default().fg(Color::Yellow))
48}