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/components/chat | |
| parent | f879a94c95678592060b3ade1d78f69f18c5866e (diff) | |
| download | opencode-c42d94c465876b3dccfd4244b5efc15f2d3b8bf1.tar.gz opencode-c42d94c465876b3dccfd4244b5efc15f2d3b8bf1.zip | |
small fixes
Diffstat (limited to 'internal/tui/components/chat')
| -rw-r--r-- | internal/tui/components/chat/editor.go | 5 | ||||
| -rw-r--r-- | internal/tui/components/chat/list.go | 22 |
2 files changed, 18 insertions, 9 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). |
