From 5451e54082426461884c3c07c8c4adca93e7dbde Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Fri, 18 Oct 2024 13:27:19 -0700 Subject: [PATCH] Linting update --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index da7751d..f938547 100644 --- a/main.go +++ b/main.go @@ -49,7 +49,8 @@ type model struct { } func initialModel(fullscreen bool, colorLeft string, colorRight string) model { - inputs := make([]textinput.Model, 3) + numInputs := 3 + inputs := make([]textinput.Model, numInputs) // Set up text input models for interval length, break length, and total intervals for i := range inputs { @@ -120,12 +121,14 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { // Move to the next input field m.focusIndex = (m.focusIndex + 1) % len(m.inputs) m.updateFocus() + return m, nil case "shift+tab": // Move to the previous input field m.focusIndex = (m.focusIndex - 1 + len(m.inputs)) % len(m.inputs) m.updateFocus() + return m, nil case "enter": @@ -188,10 +191,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.isFocus = true m.intervalNum++ m.runCommands(m.onIntervalEnd) + if m.intervalNum > m.intervals { // All intervals completed return m, tea.Quit } + m.remaining = m.remaining + m.focusTime m.totalTime = m.focusTime m.state = "Focus"