diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-24 13:01:32 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-24 16:40:36 +0200 |
| commit | c42d94c465876b3dccfd4244b5efc15f2d3b8bf1 (patch) | |
| tree | d16e886ab605c616776bb97937eaddccbb6c1b1a /internal/tui | |
| parent | f879a94c95678592060b3ade1d78f69f18c5866e (diff) | |
| download | opencode-c42d94c465876b3dccfd4244b5efc15f2d3b8bf1.tar.gz opencode-c42d94c465876b3dccfd4244b5efc15f2d3b8bf1.zip | |
small fixes
Diffstat (limited to 'internal/tui')
| -rw-r--r-- | internal/tui/components/chat/editor.go | 5 | ||||
| -rw-r--r-- | internal/tui/components/chat/list.go | 22 | ||||
| -rw-r--r-- | internal/tui/components/dialog/permission.go | 8 |
3 files changed, 22 insertions, 13 deletions
diff --git a/internal/tui/components/chat/editor.go b/internal/tui/components/chat/editor.go index bb431053a..12ed3019f 100644 --- a/internal/tui/components/chat/editor.go +++ b/internal/tui/components/chat/editor.go @@ -116,11 +116,6 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } return m, openEditor() } - // if the key does not match any binding, return - if m.textarea.Focused() && key.Matches(msg, editorMaps.Send) { - return m, m.send() - } - // Handle Enter key if m.textarea.Focused() && key.Matches(msg, editorMaps.Send) { value := m.textarea.Value() diff --git a/internal/tui/components/chat/list.go b/internal/tui/components/chat/list.go index 3ed98f6b8..9333cc9e9 100644 --- a/internal/tui/components/chat/list.go +++ b/internal/tui/components/chat/list.go @@ -83,6 +83,14 @@ func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.rendering = false return m, nil + case tea.KeyMsg: + if key.Matches(msg, messageKeys.PageUp) || key.Matches(msg, messageKeys.PageDown) || + key.Matches(msg, messageKeys.HalfPageUp) || key.Matches(msg, messageKeys.HalfPageDown) { + u, cmd := m.viewport.Update(msg) + m.viewport = u + cmds = append(cmds, cmd) + } + case renderFinishedMsg: m.rendering = false m.viewport.GotoBottom() @@ -141,10 +149,6 @@ func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } } - u, cmd := m.viewport.Update(msg) - m.viewport = u - cmds = append(cmds, cmd) - spinner, cmd := m.spinner.Update(msg) m.spinner = spinner cmds = append(cmds, cmd) @@ -352,6 +356,16 @@ func (m *messagesCmp) help() string { styles.BaseStyle.Foreground(styles.Forground).Bold(true).Render("esc"), styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render(" to exit cancel"), ) + } else { + text += lipgloss.JoinHorizontal( + lipgloss.Left, + styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render("press "), + styles.BaseStyle.Foreground(styles.Forground).Bold(true).Render("enter"), + styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render(" to send the message,"), + styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render(" write"), + styles.BaseStyle.Foreground(styles.Forground).Bold(true).Render(" \\"), + styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render(" and enter to add a new line"), + ) } return styles.BaseStyle. Width(m.width). diff --git a/internal/tui/components/dialog/permission.go b/internal/tui/components/dialog/permission.go index 8096fd960..3c7a9a3f4 100644 --- a/internal/tui/components/dialog/permission.go +++ b/internal/tui/components/dialog/permission.go @@ -64,15 +64,15 @@ var permissionsKeys = permissionsMapping{ ), Allow: key.NewBinding( key.WithKeys("a"), - key.WithHelp("a", "[a]llow"), + key.WithHelp("a", "allow"), ), AllowSession: key.NewBinding( key.WithKeys("s"), - key.WithHelp("s", "allow for [s]ession"), + key.WithHelp("s", "allow for session"), ), Deny: key.NewBinding( key.WithKeys("d"), - key.WithHelp("d", "[d]eny"), + key.WithHelp("d", "deny"), ), Tab: key.NewBinding( key.WithKeys("tab"), @@ -171,7 +171,7 @@ func (p *permissionDialogCmp) renderButtons() string { } allowButton := allowStyle.Padding(0, 1).Render("Allow (a)") - allowSessionButton := allowSessionStyle.Padding(0, 1).Render("Allow for session (A)") + allowSessionButton := allowSessionStyle.Padding(0, 1).Render("Allow for session (s)") denyButton := denyStyle.Padding(0, 1).Render("Deny (d)") content := lipgloss.JoinHorizontal( |
