Skip to content

Commit 137eeea

Browse files
authored
Merge pull request #1438 from docker/interrupt
Improve discoverability of Esc key bind
2 parents 2d1fdd3 + 996feab commit 137eeea

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pkg/tui/page/chat/chat.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,11 @@ func defaultKeyMap() KeyMap {
205205
return KeyMap{
206206
Tab: key.NewBinding(
207207
key.WithKeys("tab"),
208-
key.WithHelp("TAB", "switch focus"),
208+
key.WithHelp("Tab", "switch focus"),
209209
),
210210
Cancel: key.NewBinding(
211211
key.WithKeys("esc"),
212+
key.WithHelp("Esc", "interrupt"),
212213
),
213214
// Show newline help in footer. Terminals that support Shift+Enter will use it.
214215
// Ctrl+J acts as a fallback on terminals that don't distinguish Shift+Enter.
@@ -584,7 +585,7 @@ func (p *chatPage) updateNewlineHelp() {
584585
} else {
585586
p.keyMap.ShiftNewline = key.NewBinding(
586587
key.WithKeys("ctrl+j"),
587-
key.WithHelp("ctrl+j", "newline"),
588+
key.WithHelp("Ctrl+j", "newline"),
588589
)
589590
}
590591
}
@@ -892,6 +893,8 @@ func (p *chatPage) renderResizeHandle(width int) string {
892893
workingText = fmt.Sprintf("Working… (%d queued)", queueLen)
893894
}
894895
suffix := " " + p.spinner.View() + " " + styles.SpinnerDotsHighlightStyle.Render(workingText)
896+
cancelKeyPart := styles.HighlightWhiteStyle.Render(p.keyMap.Cancel.Help().Key)
897+
suffix += " (" + cancelKeyPart + " to interrupt)"
895898
suffixWidth := lipgloss.Width(suffix)
896899
truncated := lipgloss.NewStyle().MaxWidth(width - 2 - suffixWidth).Render(fullLine)
897900
return truncated + suffix

0 commit comments

Comments
 (0)