diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-08 22:22:31 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-08 22:22:31 +0300 |
| commit | 55d49e6a68a2b35457347df5443fe770fe474a3b (patch) | |
| tree | 62f706c948afc521c7a2f39e6582285e8c6b04c5 | |
| parent | f957b4ccecc6605aed56b36635d16ca9544931a3 (diff) | |
Refactor task d: isolate handler-specific state
| -rw-r--r-- | internal/ui/table.go | 18 | ||||
| -rw-r--r-- | internal/ui/table_test.go | 2 |
2 files changed, 15 insertions, 5 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go index ae32070..aac685b 100644 --- a/internal/ui/table.go +++ b/internal/ui/table.go @@ -85,15 +85,11 @@ type detailViewState struct { detailBlinkField int // field currently blinking (-1 = none) detailBlinkOn bool // whether the blink is currently on detailBlinkCount int // number of blink cycles completed so far - // detailDescEditing lives here (not in editState) because it drives an - // external-editor launch from the detail overlay, not inline text input. - detailDescEditing bool // whether the description editor is open } // ultraState holds the state for the ultra mode task list and its search UI. type ultraState struct { showUltra bool - ultraStartup bool // true when ultra was set via --ultra flag; q quits directly, esc never does ultraCursor int ultraOffset int ultraSearching bool @@ -103,6 +99,18 @@ type ultraState struct { ultraFocusedID int } +// detailEditState holds detail-overlay state that belongs to the external +// description editor flow instead of the overlay itself. +type detailEditState struct { + detailDescEditing bool +} + +// ultraModeState holds ultra-mode lifecycle flags that are separate from the +// cursor, search, and filter state. +type ultraModeState struct { + ultraStartup bool +} + // editState holds inline field-editing state for the task table. // Each editing mode (annotate, desc, tags, …) is mutually exclusive; // clearEditingModes resets them all before activating a new one. @@ -158,6 +166,8 @@ type Model struct { searchState // task-table and help-screen search (see searchState) detailViewState // task detail overlay (see detailViewState) ultraState // ultra mode task list and search state (see ultraState) + detailEditState // detail-overlay external description editor state + ultraModeState // ultra-mode lifecycle flags editState // inline field editing (see editState) cellExpanded bool diff --git a/internal/ui/table_test.go b/internal/ui/table_test.go index d8c9db4..fa6fbfe 100644 --- a/internal/ui/table_test.go +++ b/internal/ui/table_test.go @@ -228,7 +228,7 @@ func TestHandleDescEditDoneRemovesTempFileOnEditorError(t *testing.T) { t.Fatal(err) } - m := Model{detailViewState: detailViewState{detailDescEditing: true}} + m := Model{detailEditState: detailEditState{detailDescEditing: true}} mv, cmd := (&m).handleDescEditDone(descEditDoneMsg{ err: fmt.Errorf("editor failed"), tempFile: tempFile, |
