diff options
| author | Paul Bütow <1224732+snonux@users.noreply.github.com> | 2025-06-20 23:16:36 +0300 |
|---|---|---|
| committer | Paul Bütow <1224732+snonux@users.noreply.github.com> | 2025-06-20 23:16:36 +0300 |
| commit | 8c7bba73376ee603cb7962f8ed4051624cd0d15a (patch) | |
| tree | 0d2f5cb1fd1ec7ada0f3f25f28388b8e25e8270a /internal | |
| parent | 8ef29dbc6a38ac2ad6dde713a622b1bcbc4f2ebb (diff) | |
Always display selected cell content
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/ui/table.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go index 92ad157..c22aaa6 100644 --- a/internal/ui/table.go +++ b/internal/ui/table.go @@ -451,6 +451,7 @@ func (m Model) View() string { view := lipgloss.JoinVertical(lipgloss.Left, m.topStatusLine(), m.tbl.View(), + m.expandedCellView(), m.statusLine(), ) if m.annotating { @@ -554,6 +555,8 @@ func formatDue(s string) string { val = "today" case 1: val = "tomorrow" + case -1: + val = "yesterday" default: val = fmt.Sprintf("%dd", days) } @@ -652,3 +655,40 @@ func taskToRowSearch(t task.Task, re *regexp.Regexp) atable.Row { annStr, } } + +func (m Model) expandedCellView() string { + row := m.tbl.Cursor() + col := m.tbl.ColumnCursor() + if row < 0 || row >= len(m.tasks) || col < 0 { + return "" + } + t := m.tasks[row] + var val string + switch col { + case 0: + val = strconv.Itoa(t.ID) + case 1: + val = ansi.Strip(formatPriority(t.Priority)) + case 2: + if ts, err := time.Parse("20060102T150405Z", t.Entry); err == nil { + days := int(time.Since(ts).Hours() / 24) + val = fmt.Sprintf("%dd", days) + } + case 3: + val = fmt.Sprintf("%.1f", t.Urgency) + case 4: + val = ansi.Strip(formatDue(t.Due)) + case 5: + val = strings.Join(t.Tags, " ") + case 6: + val = t.Description + case 7: + var anns []string + for _, a := range t.Annotations { + anns = append(anns, a.Description) + } + val = strings.Join(anns, "; ") + } + style := lipgloss.NewStyle().Width(m.tbl.Width()) + return style.Render(val) +} |
