diff options
| author | adamdotdevin <[email protected]> | 2025-07-16 12:42:52 -0500 |
|---|---|---|
| committer | adamdotdevin <[email protected]> | 2025-07-16 12:43:02 -0500 |
| commit | cdc1d8a94d12a31d5d162cb37744305738177ac2 (patch) | |
| tree | a9a9494ddc5b4a1a30c28e9ef19c99541292e630 /packages/tui/internal | |
| parent | fdd6d6600f090ad4f15b2bbfc0bb75c36a722f4e (diff) | |
| download | opencode-cdc1d8a94d12a31d5d162cb37744305738177ac2.tar.gz opencode-cdc1d8a94d12a31d5d162cb37744305738177ac2.zip | |
feat(tui): layout config to render full width
Diffstat (limited to 'packages/tui/internal')
| -rw-r--r-- | packages/tui/internal/app/app.go | 6 | ||||
| -rw-r--r-- | packages/tui/internal/app/constants.go | 4 | ||||
| -rw-r--r-- | packages/tui/internal/commands/command.go | 12 | ||||
| -rw-r--r-- | packages/tui/internal/components/chat/editor.go | 25 | ||||
| -rw-r--r-- | packages/tui/internal/components/chat/message.go | 21 | ||||
| -rw-r--r-- | packages/tui/internal/components/chat/messages.go | 122 | ||||
| -rw-r--r-- | packages/tui/internal/tui/tui.go | 149 |
7 files changed, 172 insertions, 167 deletions
diff --git a/packages/tui/internal/app/app.go b/packages/tui/internal/app/app.go index 818203b98..011d5a89a 100644 --- a/packages/tui/internal/app/app.go +++ b/packages/tui/internal/app/app.go @@ -260,7 +260,7 @@ func (a *App) SwitchModeReverse() (*App, tea.Cmd) { } func (a *App) InitializeProvider() tea.Cmd { - providersResponse, err := a.Client.Config.Providers(context.Background()) + providersResponse, err := a.Client.App.Providers(context.Background()) if err != nil { slog.Error("Failed to list providers", "error", err) // TODO: notify user @@ -355,7 +355,7 @@ func (a *App) InitializeProvider() tea.Cmd { } func getDefaultModel( - response *opencode.ConfigProvidersResponse, + response *opencode.AppProvidersResponse, provider opencode.Provider, ) *opencode.Model { if match, ok := response.Default[provider.ID]; ok { @@ -618,7 +618,7 @@ func (a *App) ListMessages(ctx context.Context, sessionId string) ([]Message, er } func (a *App) ListProviders(ctx context.Context) ([]opencode.Provider, error) { - response, err := a.Client.Config.Providers(ctx) + response, err := a.Client.App.Providers(ctx) if err != nil { return nil, err } diff --git a/packages/tui/internal/app/constants.go b/packages/tui/internal/app/constants.go new file mode 100644 index 000000000..0d37833f5 --- /dev/null +++ b/packages/tui/internal/app/constants.go @@ -0,0 +1,4 @@ +package app + +const MAX_CONTAINER_WIDTH = 86 +const EDIT_DIFF_MAX_WIDTH = 180 diff --git a/packages/tui/internal/commands/command.go b/packages/tui/internal/commands/command.go index 6ceec5fa1..6af7a4568 100644 --- a/packages/tui/internal/commands/command.go +++ b/packages/tui/internal/commands/command.go @@ -230,12 +230,12 @@ func LoadFromConfig(config *opencode.Config) CommandRegistry { Keybindings: parseBindings("<leader>t"), Trigger: []string{"themes"}, }, - { - Name: FileListCommand, - Description: "list files", - Keybindings: parseBindings("<leader>f"), - Trigger: []string{"files"}, - }, + // { + // Name: FileListCommand, + // Description: "list files", + // Keybindings: parseBindings("<leader>f"), + // Trigger: []string{"files"}, + // }, { Name: FileCloseCommand, Description: "close file", diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go index 67f1f75ea..de74b4895 100644 --- a/packages/tui/internal/components/chat/editor.go +++ b/packages/tui/internal/components/chat/editor.go @@ -27,8 +27,8 @@ import ( type EditorComponent interface { tea.Model - View(width int) string - Content(width int) string + tea.ViewModel + Content() string Lines() int Value() string Length() int @@ -46,6 +46,7 @@ type EditorComponent interface { type editorComponent struct { app *app.App + width int textarea textarea.Model spinner spinner.Model interruptKeyInDebounce bool @@ -61,6 +62,12 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmd tea.Cmd switch msg := msg.(type) { + case tea.WindowSizeMsg: + m.width = min(msg.Width-4, app.MAX_CONTAINER_WIDTH) + if m.app.Config.Layout == opencode.LayoutConfigStretch { + m.width = msg.Width - 4 + } + return m, nil case spinner.TickMsg: m.spinner, cmd = m.spinner.Update(msg) return m, cmd @@ -227,7 +234,7 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, tea.Batch(cmds...) } -func (m *editorComponent) Content(width int) string { +func (m *editorComponent) Content() string { t := theme.CurrentTheme() base := styles.NewStyle().Foreground(t.Text()).Background(t.Background()).Render muted := styles.NewStyle().Foreground(t.TextMuted()).Background(t.Background()).Render @@ -236,7 +243,7 @@ func (m *editorComponent) Content(width int) string { Bold(true) prompt := promptStyle.Render(">") - m.textarea.SetWidth(width - 6) + m.textarea.SetWidth(m.width - 6) textarea := lipgloss.JoinHorizontal( lipgloss.Top, prompt, @@ -248,7 +255,7 @@ func (m *editorComponent) Content(width int) string { } textarea = styles.NewStyle(). Background(t.BackgroundElement()). - Width(width). + Width(m.width). PaddingTop(1). PaddingBottom(1). BorderStyle(lipgloss.ThickBorder()). @@ -284,7 +291,7 @@ func (m *editorComponent) Content(width int) string { model = muted(m.app.Provider.Name) + base(" "+m.app.Model.Name) } - space := width - 2 - lipgloss.Width(model) - lipgloss.Width(hint) + space := m.width - 2 - lipgloss.Width(model) - lipgloss.Width(hint) spacer := styles.NewStyle().Background(t.Background()).Width(space).Render("") info := hint + spacer + model @@ -294,10 +301,10 @@ func (m *editorComponent) Content(width int) string { return content } -func (m *editorComponent) View(width int) string { +func (m *editorComponent) View() string { if m.Lines() > 1 { return lipgloss.Place( - width, + m.width, 5, lipgloss.Center, lipgloss.Center, @@ -305,7 +312,7 @@ func (m *editorComponent) View(width int) string { styles.WhitespaceStyle(theme.CurrentTheme().Background()), ) } - return m.Content(width) + return m.Content() } func (m *editorComponent) Focused() bool { diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go index 35ff675bd..d3263b053 100644 --- a/packages/tui/internal/components/chat/message.go +++ b/packages/tui/internal/components/chat/message.go @@ -10,6 +10,7 @@ import ( "github.com/charmbracelet/lipgloss/v2" "github.com/charmbracelet/lipgloss/v2/compat" "github.com/charmbracelet/x/ansi" + "github.com/muesli/reflow/truncate" "github.com/sst/opencode-sdk-go" "github.com/sst/opencode/internal/app" "github.com/sst/opencode/internal/components/diff" @@ -319,11 +320,19 @@ func renderToolDetails( if diffField != nil { patch := diffField.(string) var formattedDiff string - formattedDiff, _ = diff.FormatUnifiedDiff( - filename, - patch, - diff.WithWidth(width-2), - ) + if width < 120 { + formattedDiff, _ = diff.FormatUnifiedDiff( + filename, + patch, + diff.WithWidth(width-2), + ) + } else { + formattedDiff, _ = diff.FormatDiff( + filename, + patch, + diff.WithWidth(width-2), + ) + } body = strings.TrimSpace(formattedDiff) style := styles.NewStyle(). Background(backgroundColor). @@ -551,6 +560,8 @@ func renderToolTitle( toolName := renderToolName(toolCall.Tool) title = fmt.Sprintf("%s %s", toolName, toolArgs) } + + title = truncate.StringWithTail(title, uint(width-6), "...") return title } diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go index 739f69109..e17847645 100644 --- a/packages/tui/internal/components/chat/messages.go +++ b/packages/tui/internal/components/chat/messages.go @@ -19,8 +19,7 @@ import ( type MessagesComponent interface { tea.Model - View(width, height int) string - SetWidth(width int) tea.Cmd + tea.ViewModel PageUp() (tea.Model, tea.Cmd) PageDown() (tea.Model, tea.Cmd) HalfPageUp() (tea.Model, tea.Cmd) @@ -32,8 +31,9 @@ type MessagesComponent interface { } type messagesComponent struct { - width int + width, height int app *app.App + header string viewport viewport.Model cache *PartCache rendering bool @@ -53,6 +53,17 @@ func (m *messagesComponent) Init() tea.Cmd { func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) { var cmds []tea.Cmd switch msg := msg.(type) { + case tea.WindowSizeMsg: + effectiveWidth := msg.Width - 4 + // Clear cache on resize since width affects rendering + if m.width != effectiveWidth { + m.cache.Clear() + } + m.width = effectiveWidth + m.height = msg.Height - 7 + m.viewport.SetWidth(m.width) + m.header = m.renderHeader() + return m, m.Reload() case app.SendMsg: m.viewport.GotoBottom() m.tail = true @@ -82,21 +93,18 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case opencode.EventListResponseEventSessionUpdated: if msg.Properties.Info.ID == m.app.Session.ID { - m.renderView(m.width) - if m.tail { - m.viewport.GotoBottom() - } + m.header = m.renderHeader() } case opencode.EventListResponseEventMessageUpdated: if msg.Properties.Info.SessionID == m.app.Session.ID { - m.renderView(m.width) + m.renderView() if m.tail { m.viewport.GotoBottom() } } case opencode.EventListResponseEventMessagePartUpdated: if msg.Properties.Part.SessionID == m.app.Session.ID { - m.renderView(m.width) + m.renderView() if m.tail { m.viewport.GotoBottom() } @@ -111,10 +119,12 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, tea.Batch(cmds...) } -func (m *messagesComponent) renderView(width int) { +func (m *messagesComponent) renderView() { measure := util.Measure("messages.renderView") defer measure("messageCount", len(m.app.Messages)) + m.header = m.renderHeader() + t := theme.CurrentTheme() blocks := make([]string, 0) m.partCount = 0 @@ -122,6 +132,11 @@ func (m *messagesComponent) renderView(width int) { orphanedToolCalls := make([]opencode.ToolPart, 0) + width := min(m.width, app.MAX_CONTAINER_WIDTH) + if m.app.Config.Layout == opencode.LayoutConfigStretch { + width = m.width + } + for _, message := range m.app.Messages { var content string var cached bool @@ -185,6 +200,12 @@ func (m *messagesComponent) renderView(width int) { width, files, ) + content = lipgloss.PlaceHorizontal( + m.width, + lipgloss.Center, + content, + styles.WhitespaceStyle(t.Background()), + ) m.cache.Set(key, content) } if content != "" { @@ -246,6 +267,12 @@ func (m *messagesComponent) renderView(width int) { "", toolCallParts..., ) + content = lipgloss.PlaceHorizontal( + m.width, + lipgloss.Center, + content, + styles.WhitespaceStyle(t.Background()), + ) m.cache.Set(key, content) } } else { @@ -259,6 +286,12 @@ func (m *messagesComponent) renderView(width int) { "", toolCallParts..., ) + content = lipgloss.PlaceHorizontal( + m.width, + lipgloss.Center, + content, + styles.WhitespaceStyle(t.Background()), + ) } if content != "" { m.partCount++ @@ -273,6 +306,13 @@ func (m *messagesComponent) renderView(width int) { continue } + width := width + if m.app.Config.Layout == opencode.LayoutConfigAuto && + part.Tool == "edit" && + part.State.Error == "" { + width = min(m.width, app.EDIT_DIFF_MAX_WIDTH) + } + if part.State.Status == opencode.ToolPartStateStatusCompleted || part.State.Status == opencode.ToolPartStateStatusError { key := m.cache.GenerateKey(casted.ID, part.ID, @@ -286,6 +326,12 @@ func (m *messagesComponent) renderView(width int) { part, width, ) + content = lipgloss.PlaceHorizontal( + m.width, + lipgloss.Center, + content, + styles.WhitespaceStyle(t.Background()), + ) m.cache.Set(key, content) } } else { @@ -295,6 +341,12 @@ func (m *messagesComponent) renderView(width int) { part, width, ) + content = lipgloss.PlaceHorizontal( + m.width, + lipgloss.Center, + content, + styles.WhitespaceStyle(t.Background()), + ) } if content != "" { m.partCount++ @@ -333,22 +385,27 @@ func (m *messagesComponent) renderView(width int) { } } + m.viewport.SetHeight(m.height - lipgloss.Height(m.header)) m.viewport.SetContent("\n" + strings.Join(blocks, "\n\n")) - } -func (m *messagesComponent) header(width int) string { +func (m *messagesComponent) renderHeader() string { if m.app.Session.ID == "" { return "" } + headerWidth := min(m.width, app.MAX_CONTAINER_WIDTH) + if m.app.Config.Layout == opencode.LayoutConfigStretch { + headerWidth = m.width + } + t := theme.CurrentTheme() base := styles.NewStyle().Foreground(t.Text()).Background(t.Background()).Render muted := styles.NewStyle().Foreground(t.TextMuted()).Background(t.Background()).Render headerLines := []string{} headerLines = append( headerLines, - util.ToMarkdown("# "+m.app.Session.Title, width-6, t.Background()), + util.ToMarkdown("# "+m.app.Session.Title, headerWidth-6, t.Background()), ) share := "" @@ -397,7 +454,7 @@ func (m *messagesComponent) header(width int) string { Direction: layout.Row, Justify: layout.JustifySpaceBetween, Align: layout.AlignStretch, - Width: width - 6, + Width: headerWidth - 6, }, layout.FlexItem{ View: share, @@ -408,12 +465,10 @@ func (m *messagesComponent) header(width int) string { ) headerLines = append(headerLines, share) - header := strings.Join(headerLines, "\n") - header = styles.NewStyle(). Background(t.Background()). - Width(width). + Width(headerWidth). PaddingLeft(2). PaddingRight(2). BorderLeft(true). @@ -422,6 +477,12 @@ func (m *messagesComponent) header(width int) string { BorderForeground(t.BackgroundElement()). BorderStyle(lipgloss.ThickBorder()). Render(header) + header = lipgloss.PlaceHorizontal( + m.width, + lipgloss.Center, + header, + styles.WhitespaceStyle(t.Background()), + ) return "\n" + header + "\n" } @@ -473,44 +534,27 @@ func formatTokensAndCost( ) } -func (m *messagesComponent) View(width, height int) string { +func (m *messagesComponent) View() string { t := theme.CurrentTheme() if m.rendering { return lipgloss.Place( - width, - height, + m.width, + m.height, lipgloss.Center, lipgloss.Center, styles.NewStyle().Background(t.Background()).Render(""), styles.WhitespaceStyle(t.Background()), ) } - header := m.header(width) - m.viewport.SetWidth(width) - m.viewport.SetHeight(height - lipgloss.Height(header)) return styles.NewStyle(). Background(t.Background()). - Render(header + "\n" + m.viewport.View()) -} - -func (m *messagesComponent) SetWidth(width int) tea.Cmd { - if m.width == width { - return nil - } - // Clear cache on resize since width affects rendering - if m.width != width { - m.cache.Clear() - } - m.width = width - m.viewport.SetWidth(width) - m.renderView(width) - return nil + Render(m.header + "\n" + m.viewport.View()) } func (m *messagesComponent) Reload() tea.Cmd { return func() tea.Msg { - m.renderView(m.width) + m.renderView() return renderFinishedMsg{} } } diff --git a/packages/tui/internal/tui/tui.go b/packages/tui/internal/tui/tui.go index eb7d1d3c5..6210ab7b1 100644 --- a/packages/tui/internal/tui/tui.go +++ b/packages/tui/internal/tui/tui.go @@ -56,7 +56,6 @@ const ( const interruptDebounceTimeout = 1 * time.Second const exitDebounceTimeout = 1 * time.Second -const fileViewerFullWidthCutoff = 160 type appModel struct { width, height int @@ -77,10 +76,6 @@ type appModel struct { exitKeyState ExitKeyState messagesRight bool fileViewer fileviewer.Model - lastMouse tea.Mouse - fileViewerStart int - fileViewerEnd int - fileViewerHit bool } func (a appModel) Init() tea.Cmd { @@ -288,30 +283,16 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return a, cmd case tea.MouseWheelMsg: if a.modal != nil { - return a, nil - } - - var cmd tea.Cmd - if a.fileViewerHit { - a.fileViewer, cmd = a.fileViewer.Update(msg) - cmds = append(cmds, cmd) - } else { - updated, cmd := a.messages.Update(msg) - a.messages = updated.(chat.MessagesComponent) + u, cmd := a.modal.Update(msg) + a.modal = u.(layout.Modal) cmds = append(cmds, cmd) + return a, tea.Batch(cmds...) } + updated, cmd := a.messages.Update(msg) + a.messages = updated.(chat.MessagesComponent) + cmds = append(cmds, cmd) return a, tea.Batch(cmds...) - case tea.MouseMotionMsg: - a.lastMouse = msg.Mouse() - a.fileViewerHit = a.fileViewer.HasFile() && - a.lastMouse.X > a.fileViewerStart && - a.lastMouse.X < a.fileViewerEnd - case tea.MouseClickMsg: - a.lastMouse = msg.Mouse() - a.fileViewerHit = a.fileViewer.HasFile() && - a.lastMouse.X > a.fileViewerStart && - a.lastMouse.X < a.fileViewerEnd case tea.BackgroundColorMsg: styles.Terminal = &styles.TerminalInfo{ Background: msg.Color, @@ -458,14 +439,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case tea.WindowSizeMsg: msg.Height -= 2 // Make space for the status bar a.width, a.height = msg.Width, msg.Height - container := min(a.width, 104) - if a.fileViewer.HasFile() { - if a.width < fileViewerFullWidthCutoff { - container = a.width - } else { - container = min(min(a.width, max(a.width/2, 50)), 104) - } - } + container := min(a.width, app.MAX_CONTAINER_WIDTH) layout.Current = &layout.LayoutInfo{ Viewport: layout.Dimensions{ Width: a.width, @@ -475,21 +449,6 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { Width: container, }, } - mainWidth := layout.Current.Container.Width - a.messages.SetWidth(mainWidth - 4) - - sideWidth := a.width - mainWidth - if a.width < fileViewerFullWidthCutoff { - sideWidth = a.width - } - a.fileViewerStart = mainWidth - a.fileViewerEnd = a.fileViewerStart + sideWidth - if a.messagesRight { - a.fileViewerStart = 0 - a.fileViewerEnd = sideWidth - } - a.fileViewer, cmd = a.fileViewer.SetSize(sideWidth, layout.Current.Viewport.Height) - cmds = append(cmds, cmd) case app.SessionSelectedMsg: messages, err := a.app.ListMessages(context.Background(), msg.ID) if err != nil { @@ -569,48 +528,22 @@ func (a appModel) View() string { t := theme.CurrentTheme() var mainLayout string - mainWidth := layout.Current.Container.Width - 4 + if a.app.Session.ID == "" { - mainLayout = a.home(mainWidth) + mainLayout = a.home() } else { - mainLayout = a.chat(mainWidth) + mainLayout = a.chat() } mainLayout = styles.NewStyle(). Background(t.Background()). Padding(0, 2). Render(mainLayout) - - mainHeight := lipgloss.Height(mainLayout) - - if a.fileViewer.HasFile() { - file := a.fileViewer.View() - baseStyle := styles.NewStyle().Background(t.BackgroundPanel()) - sidePanel := baseStyle.Height(mainHeight).Render(file) - if a.width >= fileViewerFullWidthCutoff { - if a.messagesRight { - mainLayout = lipgloss.JoinHorizontal( - lipgloss.Top, - sidePanel, - mainLayout, - ) - } else { - mainLayout = lipgloss.JoinHorizontal( - lipgloss.Top, - mainLayout, - sidePanel, - ) - } - } else { - mainLayout = sidePanel - } - } else { - mainLayout = lipgloss.PlaceHorizontal( - a.width, - lipgloss.Center, - mainLayout, - styles.WhitespaceStyle(t.Background()), - ) - } + mainLayout = lipgloss.PlaceHorizontal( + a.width, + lipgloss.Center, + mainLayout, + styles.WhitespaceStyle(t.Background()), + ) mainStyle := styles.NewStyle().Background(t.Background()) mainLayout = mainStyle.Render(mainLayout) @@ -646,8 +579,9 @@ func (a appModel) openFile(filepath string) (tea.Model, tea.Cmd) { return a, cmd } -func (a appModel) home(width int) string { +func (a appModel) home() string { t := theme.CurrentTheme() + effectiveWidth := a.width - 4 baseStyle := styles.NewStyle().Background(t.Background()) base := baseStyle.Render muted := styles.NewStyle().Foreground(t.TextMuted()).Background(t.Background()).Render @@ -678,7 +612,7 @@ func (a appModel) home(width int) string { logoAndVersion := strings.Join([]string{logo, version}, "\n") logoAndVersion = lipgloss.PlaceHorizontal( - width, + effectiveWidth, lipgloss.Center, logoAndVersion, styles.WhitespaceStyle(t.Background()), @@ -689,7 +623,7 @@ func (a appModel) home(width int) string { cmdcomp.WithLimit(6), ) cmds := lipgloss.PlaceHorizontal( - width, + effectiveWidth, lipgloss.Center, commandsView.View(), styles.WhitespaceStyle(t.Background()), @@ -701,19 +635,16 @@ func (a appModel) home(width int) string { lines = append(lines, logoAndVersion) lines = append(lines, "") lines = append(lines, "") - // lines = append(lines, base("cwd ")+muted(cwd)) - // lines = append(lines, base("config ")+muted(config)) - // lines = append(lines, "") lines = append(lines, cmds) lines = append(lines, "") lines = append(lines, "") mainHeight := lipgloss.Height(strings.Join(lines, "\n")) - editorWidth := min(width, 80) - editorView := a.editor.View(editorWidth) + editorView := a.editor.View() + editorWidth := lipgloss.Width(editorView) editorView = lipgloss.PlaceHorizontal( - width, + effectiveWidth, lipgloss.Center, editorView, styles.WhitespaceStyle(t.Background()), @@ -723,7 +654,7 @@ func (a appModel) home(width int) string { editorLines := a.editor.Lines() mainLayout := lipgloss.Place( - width, + effectiveWidth, a.height, lipgloss.Center, lipgloss.Center, @@ -731,14 +662,14 @@ func (a appModel) home(width int) string { styles.WhitespaceStyle(t.Background()), ) - editorX := (width - editorWidth) / 2 + editorX := (effectiveWidth - editorWidth) / 2 editorY := (a.height / 2) + (mainHeight / 2) - 2 if editorLines > 1 { mainLayout = layout.PlaceOverlay( editorX, editorY, - a.editor.Content(editorWidth), + a.editor.Content(), mainLayout, ) } @@ -759,23 +690,31 @@ func (a appModel) home(width int) string { return mainLayout } -func (a appModel) chat(width int) string { - editorView := a.editor.View(width) +func (a appModel) chat() string { + effectiveWidth := a.width - 4 + t := theme.CurrentTheme() + editorView := a.editor.View() lines := a.editor.Lines() - messagesView := a.messages.View(width, a.height-5) + messagesView := a.messages.View() editorWidth := lipgloss.Width(editorView) editorHeight := max(lines, 5) + editorView = lipgloss.PlaceHorizontal( + effectiveWidth, + lipgloss.Center, + editorView, + styles.WhitespaceStyle(t.Background()), + ) mainLayout := messagesView + "\n" + editorView - editorX := (a.width - editorWidth) / 2 + editorX := (effectiveWidth - editorWidth) / 2 if lines > 1 { editorY := a.height - editorHeight mainLayout = layout.PlaceOverlay( editorX, editorY, - a.editor.Content(width), + a.editor.Content(), mainLayout, ) } @@ -968,11 +907,11 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd) case commands.ThemeListCommand: themeDialog := dialog.NewThemeDialog() a.modal = themeDialog - case commands.FileListCommand: - a.editor.Blur() - findDialog := dialog.NewFindDialog(a.fileProvider) - cmds = append(cmds, findDialog.Init()) - a.modal = findDialog + // case commands.FileListCommand: + // a.editor.Blur() + // findDialog := dialog.NewFindDialog(a.fileProvider) + // cmds = append(cmds, findDialog.Init()) + // a.modal = findDialog case commands.FileCloseCommand: a.fileViewer, cmd = a.fileViewer.Clear() cmds = append(cmds, cmd) |
