summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/components/dialog
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-06-12 06:06:53 -0500
committeradamdottv <[email protected]>2025-06-12 16:00:24 -0500
commitae339015fc7c96a98c2e4c0a359d5500c7801c15 (patch)
treebc2439001ed802ccf565070c8f9ccd5e70ea10b5 /packages/tui/internal/components/dialog
parentcce2e4ad754479917fc8f6f24c1421cf19c04573 (diff)
downloadopencode-ae339015fc7c96a98c2e4c0a359d5500c7801c15.tar.gz
opencode-ae339015fc7c96a98c2e4c0a359d5500c7801c15.zip
wip: refactoring tui
Diffstat (limited to 'packages/tui/internal/components/dialog')
-rw-r--r--packages/tui/internal/components/dialog/complete.go20
-rw-r--r--packages/tui/internal/components/dialog/session.go4
2 files changed, 12 insertions, 12 deletions
diff --git a/packages/tui/internal/components/dialog/complete.go b/packages/tui/internal/components/dialog/complete.go
index 91ac8f7b8..a399b503b 100644
--- a/packages/tui/internal/components/dialog/complete.go
+++ b/packages/tui/internal/components/dialog/complete.go
@@ -82,7 +82,7 @@ type CompletionDialog interface {
SetWidth(width int)
}
-type completionDialogCmp struct {
+type completionDialogComponent struct {
query string
completionProvider CompletionProvider
width int
@@ -105,11 +105,11 @@ var completionDialogKeys = completionDialogKeyMap{
),
}
-func (c *completionDialogCmp) Init() tea.Cmd {
+func (c *completionDialogComponent) Init() tea.Cmd {
return nil
}
-func (c *completionDialogCmp) complete(item CompletionItemI) tea.Cmd {
+func (c *completionDialogComponent) complete(item CompletionItemI) tea.Cmd {
value := c.pseudoSearchTextArea.Value()
if value == "" {
@@ -125,7 +125,7 @@ func (c *completionDialogCmp) complete(item CompletionItemI) tea.Cmd {
)
}
-func (c *completionDialogCmp) close() tea.Cmd {
+func (c *completionDialogComponent) close() tea.Cmd {
c.listView.SetItems([]CompletionItemI{})
c.pseudoSearchTextArea.Reset()
c.pseudoSearchTextArea.Blur()
@@ -133,7 +133,7 @@ func (c *completionDialogCmp) close() tea.Cmd {
return util.CmdHandler(CompletionDialogCloseMsg{})
}
-func (c *completionDialogCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
+func (c *completionDialogComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmds []tea.Cmd
switch msg := msg.(type) {
case tea.KeyMsg:
@@ -203,7 +203,7 @@ func (c *completionDialogCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return c, tea.Batch(cmds...)
}
-func (c *completionDialogCmp) View() string {
+func (c *completionDialogComponent) View() string {
t := theme.CurrentTheme()
baseStyle := styles.BaseStyle()
@@ -231,15 +231,15 @@ func (c *completionDialogCmp) View() string {
Render(c.listView.View())
}
-func (c *completionDialogCmp) SetWidth(width int) {
+func (c *completionDialogComponent) SetWidth(width int) {
c.width = width
}
-func (c *completionDialogCmp) BindingKeys() []key.Binding {
+func (c *completionDialogComponent) BindingKeys() []key.Binding {
return layout.KeyMapToSlice(completionDialogKeys)
}
-func NewCompletionDialogCmp(completionProvider CompletionProvider) CompletionDialog {
+func NewCompletionDialogComponent(completionProvider CompletionProvider) CompletionDialog {
ti := textarea.New()
items, err := completionProvider.GetChildEntries("")
@@ -254,7 +254,7 @@ func NewCompletionDialogCmp(completionProvider CompletionProvider) CompletionDia
false,
)
- return &completionDialogCmp{
+ return &completionDialogComponent{
query: "",
completionProvider: completionProvider,
pseudoSearchTextArea: ti,
diff --git a/packages/tui/internal/components/dialog/session.go b/packages/tui/internal/components/dialog/session.go
index 8ef9a701f..a524f494c 100644
--- a/packages/tui/internal/components/dialog/session.go
+++ b/packages/tui/internal/components/dialog/session.go
@@ -122,7 +122,7 @@ func (s *sessionDialogComponent) View() string {
maxWidth := 40 // Minimum width
for _, sess := range s.sessions {
if len(sess.Title) > maxWidth-4 { // Account for padding
- maxWidth = len(sess.Title) + 4
+ maxWidth = len(sess.Title) + 0
}
}
@@ -173,7 +173,7 @@ func (s *sessionDialogComponent) View() string {
lipgloss.Left,
title,
baseStyle.Width(maxWidth).Render(""),
- baseStyle.Width(maxWidth).Render(lipgloss.JoinVertical(lipgloss.Left, sessionItems...)),
+ baseStyle.Width(maxWidth-2).Render(lipgloss.JoinVertical(lipgloss.Left, sessionItems...)),
baseStyle.Width(maxWidth).Render(""),
)