From 8c7bba73376ee603cb7962f8ed4051624cd0d15a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20B=C3=BCtow?= <1224732+snonux@users.noreply.github.com> Date: Fri, 20 Jun 2025 23:16:36 +0300 Subject: Always display selected cell content --- internal/ui/table.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) 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) +} -- cgit v1.2.3