From 117fa5085b1b2b83e0023a433225d9fa0c0c6730 Mon Sep 17 00:00:00 2001 From: june Date: Sun, 9 Mar 2025 11:10:30 +1300 Subject: [PATCH] YAYAY textinput working now --- bubbletea.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bubbletea.go b/bubbletea.go index f2c6a39..9b3e395 100644 --- a/bubbletea.go +++ b/bubbletea.go @@ -51,6 +51,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // new task case "n": m.addTask = true + m.textinput.Focus() case "esc": m.addTask = false @@ -66,9 +67,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } } } - - m.textinput, cmd = m.textinput.Update(msg) - + if m.addTask { + m.textinput, cmd = m.textinput.Update(msg) + } // Return the updated model to the Bubble Tea runtime for processing. // Note that we're not returning a command. return m, cmd @@ -118,8 +119,7 @@ func (m model) View() string { // render tab bar for i, v := range []string{"Inbox", "Today", "Tomorrow", "Scheduled", "Anytime"} { if i == m.tab { - s += lipgloss. - NewStyle(). + s += lipgloss.NewStyle(). Bold(true). Underline(true). PaddingRight(3). @@ -136,8 +136,6 @@ func (m model) View() string { if m.addTask { s += ": " - m.textinput.Focus() - m.textinput.Cursor.BlinkCmd() s += m.textinput.View() }