diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-17 13:45:26 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-21 13:42:02 +0200 |
| commit | c24e3c18e0177e2e059f622a63e87249c52db2d5 (patch) | |
| tree | 51900cfe51292d61aa137ea03d43039aff627a71 /internal/tui/page | |
| parent | caea29375994373f6027c8dc4d8aa536c4e135e7 (diff) | |
| download | opencode-c24e3c18e0177e2e059f622a63e87249c52db2d5.tar.gz opencode-c24e3c18e0177e2e059f622a63e87249c52db2d5.zip | |
small improvements
Diffstat (limited to 'internal/tui/page')
| -rw-r--r-- | internal/tui/page/chat.go | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/internal/tui/page/chat.go b/internal/tui/page/chat.go index c268e677f..632e10764 100644 --- a/internal/tui/page/chat.go +++ b/internal/tui/page/chat.go @@ -15,9 +15,12 @@ import ( var ChatPage PageID = "chat" type chatPage struct { - app *app.App - layout layout.SplitPaneLayout - session session.Session + app *app.App + editor layout.Container + messages layout.Container + layout layout.SplitPaneLayout + session session.Session + editingMode bool } type ChatKeyMap struct { @@ -59,6 +62,8 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if cmd != nil { return p, cmd } + case chat.EditorFocusMsg: + p.editingMode = bool(msg) case tea.KeyMsg: switch { case key.Matches(msg, keyMap.NewSession): @@ -133,7 +138,11 @@ func (p *chatPage) View() string { func (p *chatPage) BindingKeys() []key.Binding { bindings := layout.KeyMapToSlice(keyMap) - bindings = append(bindings, p.layout.BindingKeys()...) + if p.editingMode { + bindings = append(bindings, p.editor.BindingKeys()...) + } else { + bindings = append(bindings, p.messages.BindingKeys()...) + } return bindings } @@ -148,7 +157,10 @@ func NewChatPage(app *app.App) tea.Model { layout.WithBorder(true, false, false, false), ) return &chatPage{ - app: app, + app: app, + editor: editorContainer, + messages: messagesContainer, + editingMode: true, layout: layout.NewSplitPane( layout.WithLeftPanel(messagesContainer), layout.WithBottomPanel(editorContainer), |
