summaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-18 22:30:41 -0400
committerDax Raad <[email protected]>2025-05-26 12:40:17 -0400
commit99af6146d5def31c59993636d60eb75a483a283b (patch)
treeeb57ed227c15cf9be54bc9f231c83895d812f881 /internal
parent020e0ca039287b73fa33041fbd1bb214e6ccb396 (diff)
downloadopencode-99af6146d5def31c59993636d60eb75a483a283b.tar.gz
opencode-99af6146d5def31c59993636d60eb75a483a283b.zip
openapi
Diffstat (limited to 'internal')
-rw-r--r--internal/tui/tui.go35
1 files changed, 17 insertions, 18 deletions
diff --git a/internal/tui/tui.go b/internal/tui/tui.go
index 56be04619..ebed1182a 100644
--- a/internal/tui/tui.go
+++ b/internal/tui/tui.go
@@ -83,7 +83,7 @@ var keys = keyMap{
key.WithKeys("ctrl+t"),
key.WithHelp("ctrl+t", "switch theme"),
),
-
+
Tools: key.NewBinding(
key.WithKeys("f9"),
key.WithHelp("f9", "show available tools"),
@@ -144,7 +144,7 @@ type appModel struct {
showMultiArgumentsDialog bool
multiArgumentsDialog dialog.MultiArgumentsDialogCmp
-
+
showToolsDialog bool
toolsDialog dialog.ToolsDialog
}
@@ -299,11 +299,11 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case dialog.CloseThemeDialogMsg:
a.showThemeDialog = false
return a, nil
-
+
case dialog.CloseToolsDialogMsg:
a.showToolsDialog = false
return a, nil
-
+
case dialog.ShowToolsDialogMsg:
a.showToolsDialog = msg.Show
return a, nil
@@ -436,7 +436,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.showThemeDialog = false
a.showModelDialog = false
a.showFilepicker = false
-
+
// Load sessions and show the dialog
sessions, err := a.app.Sessions.List(context.Background())
if err != nil {
@@ -457,7 +457,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// Close other dialogs
a.showToolsDialog = false
a.showModelDialog = false
-
+
// Show commands dialog
if len(a.commands) == 0 {
status.Warn("No commands available")
@@ -478,7 +478,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.showToolsDialog = false
a.showThemeDialog = false
a.showFilepicker = false
-
+
a.showModelDialog = true
return a, nil
}
@@ -489,17 +489,17 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.showToolsDialog = false
a.showModelDialog = false
a.showFilepicker = false
-
+
a.showThemeDialog = true
return a, a.themeDialog.Init()
}
return a, nil
case key.Matches(msg, keys.Tools):
// Check if any other dialog is open
- if a.currentPage == page.ChatPage && !a.showQuit && !a.showPermissions &&
- !a.showSessionDialog && !a.showCommandDialog && !a.showThemeDialog &&
- !a.showFilepicker && !a.showModelDialog && !a.showInitDialog &&
- !a.showMultiArgumentsDialog {
+ if a.currentPage == page.ChatPage && !a.showQuit && !a.showPermissions &&
+ !a.showSessionDialog && !a.showCommandDialog && !a.showThemeDialog &&
+ !a.showFilepicker && !a.showModelDialog && !a.showInitDialog &&
+ !a.showMultiArgumentsDialog {
// Toggle tools dialog
a.showToolsDialog = !a.showToolsDialog
if a.showToolsDialog {
@@ -555,7 +555,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return a, nil
}
a.showHelp = !a.showHelp
-
+
// Close other dialogs if opening help
if a.showHelp {
a.showToolsDialog = false
@@ -574,7 +574,6 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.showFilepicker = !a.showFilepicker
a.filepicker.ToggleFilepicker(a.showFilepicker)
a.app.SetFilepickerOpen(a.showFilepicker)
-
// Close other dialogs if opening filepicker
if a.showFilepicker {
a.showToolsDialog = false
@@ -681,7 +680,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return a, tea.Batch(cmds...)
}
}
-
+
if a.showToolsDialog {
d, toolsCmd := a.toolsDialog.Update(msg)
a.toolsDialog = d.(dialog.ToolsDialog)
@@ -716,13 +715,13 @@ func getAvailableToolNames(app *app.App) []string {
app.History,
app.LSPClients,
)
-
+
// Extract tool names
var toolNames []string
for _, tool := range allTools {
toolNames = append(toolNames, tool.Info().Name)
}
-
+
return toolNames
}
@@ -931,7 +930,7 @@ func (a appModel) View() string {
true,
)
}
-
+
if a.showToolsDialog {
overlay := a.toolsDialog.View()
row := lipgloss.Height(appView) / 2