feat(tui): display key hints in status bar and bind “?” to open help
- Add placeholder span showing shortcuts (i:Insert, m:Model, ?:Help, : Command) in the UI footer. - Insert help section describing Enter key behavior in normal and insert modes. - Extend F1 help shortcut to also trigger on “?” key (with no or Shift modifier).
This commit is contained in:
@@ -1290,7 +1290,12 @@ impl ChatApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches!(key.code, KeyCode::F(1)) {
|
if matches!(key.code, KeyCode::F(1))
|
||||||
|
|| matches!(
|
||||||
|
(key.code, key.modifiers),
|
||||||
|
(KeyCode::Char('?'), KeyModifiers::NONE | KeyModifiers::SHIFT)
|
||||||
|
)
|
||||||
|
{
|
||||||
self.mode = InputMode::Help;
|
self.mode = InputMode::Help;
|
||||||
self.status = "Help".to_string();
|
self.status = "Help".to_string();
|
||||||
return Ok(AppState::Running);
|
return Ok(AppState::Running);
|
||||||
|
|||||||
@@ -1336,6 +1336,12 @@ fn render_status(frame: &mut Frame<'_>, area: Rect, app: &ChatApp) {
|
|||||||
app.current_provider().to_string(),
|
app.current_provider().to_string(),
|
||||||
Style::default().fg(theme.text),
|
Style::default().fg(theme.text),
|
||||||
));
|
));
|
||||||
|
spans.push(Span::styled(
|
||||||
|
" i:Insert m:Model ?:Help : Command",
|
||||||
|
Style::default()
|
||||||
|
.fg(theme.placeholder)
|
||||||
|
.add_modifier(Modifier::ITALIC),
|
||||||
|
));
|
||||||
spans.push(Span::styled(" ", Style::default().fg(theme.text)));
|
spans.push(Span::styled(" ", Style::default().fg(theme.text)));
|
||||||
spans.push(Span::styled(
|
spans.push(Span::styled(
|
||||||
"Model: ",
|
"Model: ",
|
||||||
@@ -2007,6 +2013,13 @@ fn render_help(frame: &mut Frame<'_>, app: &ChatApp) {
|
|||||||
Line::from(" o → insert line below and enter insert mode"),
|
Line::from(" o → insert line below and enter insert mode"),
|
||||||
Line::from(" O → insert line above and enter insert mode"),
|
Line::from(" O → insert line above and enter insert mode"),
|
||||||
Line::from(""),
|
Line::from(""),
|
||||||
|
Line::from(vec![Span::styled(
|
||||||
|
"ENTER KEY BEHAVIOUR",
|
||||||
|
Style::default().add_modifier(Modifier::BOLD).fg(theme.info),
|
||||||
|
)]),
|
||||||
|
Line::from(" Normal mode → press Enter to send the current message"),
|
||||||
|
Line::from(" Insert mode → Enter sends · Shift+Enter inserts newline"),
|
||||||
|
Line::from(""),
|
||||||
Line::from(vec![Span::styled(
|
Line::from(vec![Span::styled(
|
||||||
"INSERT MODE KEYS",
|
"INSERT MODE KEYS",
|
||||||
Style::default().add_modifier(Modifier::BOLD).fg(theme.info),
|
Style::default().add_modifier(Modifier::BOLD).fg(theme.info),
|
||||||
|
|||||||
Reference in New Issue
Block a user