diff options
| author | adamdottv <[email protected]> | 2025-07-10 08:20:17 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-07-10 08:20:17 -0500 |
| commit | f95c3f4177fc2558005628ed458431d884444125 (patch) | |
| tree | bc7c4b15babceb1ccc00c20107973126e05a94d9 | |
| parent | d2b1307bff9bc0ad6634b6f22058841771a0adaf (diff) | |
| download | opencode-f95c3f4177fc2558005628ed458431d884444125.tar.gz opencode-f95c3f4177fc2558005628ed458431d884444125.zip | |
fix(tui): fouc in textarea on app load
| -rw-r--r-- | packages/tui/internal/components/chat/editor.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go index 6503d91e1..3bf11b231 100644 --- a/packages/tui/internal/components/chat/editor.go +++ b/packages/tui/internal/components/chat/editor.go @@ -137,7 +137,7 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) { text := string(msg) m.textarea.InsertRunesFromUserInput([]rune(text)) case dialog.ThemeSelectedMsg: - m.textarea = m.resetTextareaStyles() + m.textarea = updateTextareaStyles(m.textarea) m.spinner = createSpinner() return m, tea.Batch(m.spinner.Tick, m.textarea.Focus()) case dialog.CompletionSelectedMsg: @@ -422,14 +422,12 @@ func (m *editorComponent) getExitKeyText() string { return m.app.Commands[commands.AppExitCommand].Keys()[0] } -func (m *editorComponent) resetTextareaStyles() textarea.Model { +func updateTextareaStyles(ta textarea.Model) textarea.Model { t := theme.CurrentTheme() bgColor := t.BackgroundElement() textColor := t.Text() textMutedColor := t.TextMuted() - ta := m.textarea - ta.Styles.Blurred.Base = styles.NewStyle().Foreground(textColor).Background(bgColor).Lipgloss() ta.Styles.Blurred.CursorLine = styles.NewStyle().Background(bgColor).Lipgloss() ta.Styles.Blurred.Placeholder = styles.NewStyle(). @@ -477,6 +475,7 @@ func NewEditorComponent(app *app.App) EditorComponent { ta.Prompt = " " ta.ShowLineNumbers = false ta.CharLimit = -1 + ta = updateTextareaStyles(ta) m := &editorComponent{ app: app, @@ -484,7 +483,6 @@ func NewEditorComponent(app *app.App) EditorComponent { spinner: s, interruptKeyInDebounce: false, } - m.resetTextareaStyles() return m } |
