Skip to content

Commit 5c7607b

Browse files
committed
refactor(tui): rebuild more closely following bubbletea's conventions
This refactor loses explicit skill activation and path completion which will be reintroduced at a later date.
1 parent 6e32210 commit 5c7607b

13 files changed

Lines changed: 354 additions & 1605 deletions

internal/tui/keymap.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// SPDX-License-Identifier: GPL-3.0-only
2+
3+
package tui
4+
5+
import "charm.land/bubbles/v2/key"
6+
7+
// keyMap defines the key bindings for the application.
8+
type keyMap struct {
9+
Send key.Binding
10+
Cancel key.Binding
11+
History key.Binding
12+
PickFile key.Binding
13+
Quit key.Binding
14+
}
15+
16+
// ShortHelp implements the help.KeyMap interface. Returns a slice of bindings to be
17+
// displayed in the short version of the help. The help bubble will render help in the
18+
// order in which the help items are returned here.
19+
func (k keyMap) ShortHelp() []key.Binding {
20+
return []key.Binding{k.Send, k.Cancel, k.History, k.PickFile, k.Quit}
21+
}
22+
23+
// FullHelp implements the help.KeyMap interface. Returns an extended group of help
24+
// items, grouped by columns. The help bubble will render the help in the order in which
25+
// the help items are returned here.
26+
func (k keyMap) FullHelp() [][]key.Binding {
27+
return [][]key.Binding{k.ShortHelp()}
28+
}
29+
30+
// defaultKeyMap returns the default key bindings for the application.
31+
func defaultKeyMap() keyMap {
32+
return keyMap{
33+
Send: key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "send")),
34+
Cancel: key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "cancel")),
35+
History: key.NewBinding(key.WithKeys("up", "down"), key.WithHelp("↑/↓", "history")),
36+
PickFile: key.NewBinding(key.WithKeys("ctrl+p"), key.WithHelp("ctrl+p", "pick file")),
37+
Quit: key.NewBinding(key.WithKeys("ctrl+x"), key.WithHelp("ctrl+x", "quit")),
38+
}
39+
}

internal/tui/mention.go

Lines changed: 0 additions & 257 deletions
This file was deleted.

internal/tui/mention_test.go

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)