diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-28 14:31:52 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-28 14:31:52 +0300 |
| commit | f40a13dce33f8ab5bb47f320accb5649c4debc81 (patch) | |
| tree | 02fcd548af8ae6f00da1c33ae1bd5e1f587252b8 | |
| parent | 91b4dd563092c4dc08cdc2d2f1714912cd3eaf14 (diff) | |
refactor: rearrange table columns to place Project between Recur and Tags
Move the Project column from its position after Age to between Recur
and Tags columns for better logical grouping. This places project
information alongside other task metadata fields.
Updated all related code including:
- Column definitions in newTable and applyColumns
- Row data ordering in taskToRow and taskToRowSearch
- Column indices in expandedCellView and handleEnterOrEdit
- Search matching indices for correct column highlighting
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
| -rw-r--r-- | internal/ui/keyhandlers.go | 28 | ||||
| -rw-r--r-- | internal/ui/table.go | 20 | ||||
| -rwxr-xr-x | tasksamurai | bin | 6082776 -> 6082760 bytes |
3 files changed, 24 insertions, 24 deletions
diff --git a/internal/ui/keyhandlers.go b/internal/ui/keyhandlers.go index 71a0ddc..e806dbf 100644 --- a/internal/ui/keyhandlers.go +++ b/internal/ui/keyhandlers.go @@ -597,19 +597,7 @@ func (m *Model) handleEnterOrEdit() (tea.Model, tea.Cmd) { m.updateTableHeight() return m, nil - case 3: // Project - m.clearEditingModes() - m.projID = id - m.projEditing = true - task := m.getTaskAtCursor() - if task != nil { - m.projInput.SetValue(task.Project) - } - m.projInput.Focus() - m.updateTableHeight() - return m, nil - - case 4: // Due date + case 3: // Due date m.dueID = id task := m.getTaskAtCursor() if task != nil && task.Due != "" { @@ -626,7 +614,7 @@ func (m *Model) handleEnterOrEdit() (tea.Model, tea.Cmd) { m.updateTableHeight() return m, nil - case 5: // Recurrence + case 4: // Recurrence m.clearEditingModes() m.recurID = id m.recurEditing = true @@ -638,6 +626,18 @@ func (m *Model) handleEnterOrEdit() (tea.Model, tea.Cmd) { m.updateTableHeight() return m, nil + case 5: // Project + m.clearEditingModes() + m.projID = id + m.projEditing = true + task := m.getTaskAtCursor() + if task != nil { + m.projInput.SetValue(task.Project) + } + m.projInput.Focus() + m.updateTableHeight() + return m, nil + case 6: // Tags m.clearEditingModes() m.tagsID = id diff --git a/internal/ui/table.go b/internal/ui/table.go index 8366b57..a3157af 100644 --- a/internal/ui/table.go +++ b/internal/ui/table.go @@ -304,9 +304,9 @@ func (m *Model) newTable(rows []atable.Row) (atable.Model, atable.Styles) { {Title: "Pri", Width: m.priWidth}, {Title: "ID", Width: m.idWidth}, {Title: "Age", Width: m.ageWidth}, - {Title: "Project", Width: m.projWidth}, {Title: "Due", Width: m.dueWidth}, {Title: "Recur", Width: m.recurWidth}, + {Title: "Project", Width: m.projWidth}, {Title: "Tags", Width: m.tagsWidth}, {Title: "Annotations", Width: m.annWidth}, {Title: "Description", Width: m.descWidth}, @@ -356,7 +356,7 @@ func (m *Model) reload() error { rows = append(rows, m.taskToRowSearch(tsk, m.searchRegex, m.tblStyles, -1)) if m.searchRegex != nil { if m.searchRegex.MatchString(tsk.Project) { - m.searchMatches = append(m.searchMatches, cellMatch{row: i, col: 3}) + m.searchMatches = append(m.searchMatches, cellMatch{row: i, col: 5}) } tags := strings.Join(tsk.Tags, " ") if m.searchRegex.MatchString(tags) { @@ -900,9 +900,9 @@ func (m Model) taskToRow(t task.Task) atable.Row { m.formatPriority(t.Priority, m.priWidth), style.Render(strconv.Itoa(t.ID)), style.Render(age), - style.Render(t.Project), m.formatDue(t.Due, m.dueWidth), style.Render(recur), + style.Render(t.Project), style.Render(tags), style.Render(annStr), style.Render(t.Description), @@ -1055,9 +1055,9 @@ func (m Model) taskToRowSearch(t task.Task, re *regexp.Regexp, styles atable.Sty priStr := m.formatPriority(t.Priority, m.priWidth) idStr := getStyle(1).Render(strconv.Itoa(t.ID)) ageStr := getStyle(2).Render(age) - projStr := m.highlightCell(getStyle(3), re, t.Project) dueStr := m.formatDue(t.Due, m.dueWidth) - recurStr := m.highlightCell(getStyle(5), re, recur) + recurStr := m.highlightCell(getStyle(4), re, recur) + projStr := m.highlightCell(getStyle(5), re, t.Project) tagStr := m.highlightCell(getStyle(6), re, tags) annRaw := strings.Join(anns, "; ") annCount := "" @@ -1072,9 +1072,9 @@ func (m Model) taskToRowSearch(t task.Task, re *regexp.Regexp, styles atable.Sty priStr, idStr, ageStr, - projStr, dueStr, recurStr, + projStr, tagStr, annStr, descStr, @@ -1101,11 +1101,11 @@ func (m Model) expandedCellView() string { val = fmt.Sprintf("%dd", days) } case 3: - val = t.Project - case 4: val = ansi.Strip(m.formatDue(t.Due, m.dueWidth)) - case 5: + case 4: val = t.Recur + case 5: + val = t.Project case 6: val = strings.Join(t.Tags, " ") case 7: @@ -1269,9 +1269,9 @@ func (m *Model) applyColumns() { {Title: "Pri", Width: m.priWidth}, {Title: "ID", Width: m.idWidth}, {Title: "Age", Width: m.ageWidth}, - {Title: "Project", Width: m.projWidth}, {Title: "Due", Width: m.dueWidth}, {Title: "Recur", Width: m.recurWidth}, + {Title: "Project", Width: m.projWidth}, {Title: "Tags", Width: m.tagsWidth}, {Title: "Annotations", Width: m.annWidth}, {Title: "Description", Width: m.descWidth}, diff --git a/tasksamurai b/tasksamurai Binary files differindex 9b3623a..d0f841b 100755 --- a/tasksamurai +++ b/tasksamurai |
