From 2b439ae9fe39535ed7a111da25c9668ccf828b2e Mon Sep 17 00:00:00 2001 From: Nate Meyer <672246+notnmeyer@users.noreply.github.com> Date: Wed, 30 Sep 2026 19:46:17 -0700 Subject: [PATCH 1/2] copy from ledger --- internal/tui/tui_test.go | 21 +++++++++++++++++++++ internal/tui/update.go | 7 +++++++ internal/tui/view.go | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go index 3115869..785c951 100644 --- a/internal/tui/tui_test.go +++ b/internal/tui/tui_test.go @@ -971,6 +971,27 @@ func TestLedgerEditFollowsSelection(t *testing.T) { } } +func TestLedgerCopyFollowsSelection(t *testing.T) { + today := time.Date(2026, 7, 10, 12, 0, 0, 0, time.Local) + projectPath := t.TempDir() + seedLog(t, projectPath, "2026/07/08", "- copy me\n") + + m := newLedgerModel(t, projectPath, today) + m.moveLedgerCursor(1) // select 2026/07/08 + if day, _ := m.selectedDay(); day != "2026/07/08" { + t.Fatalf("expected 2026/07/08 selected, got %s", day) + } + + mm, cmd := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{'y'}}) + if cmd == nil { + t.Fatal("expected a copy cmd for the selected day") + } + // don't execute it — that would touch the real clipboard + if mm.(Model).mode != modeLedger { + t.Error("expected to stay on the ledger after copying") + } +} + func TestLedgerNewDayRow(t *testing.T) { today := time.Date(2026, 7, 10, 12, 0, 0, 0, time.Local) projectPath := t.TempDir() diff --git a/internal/tui/update.go b/internal/tui/update.go index ad2e434..7b08199 100644 --- a/internal/tui/update.go +++ b/internal/tui/update.go @@ -348,6 +348,13 @@ func (m Model) onLedgerKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { } return m, openEditor(m.projectPath, day) + case key.Matches(msg, m.keys.Copy): + day, ok := m.selectedDay() + if !ok { + return m, nil + } + return m, copyDay(m.projectPath, day) + case key.Matches(msg, m.keys.Older): m.moveLedgerCursor(1) // older = further down the newest-first list return m, nil diff --git a/internal/tui/view.go b/internal/tui/view.go index ecee2c2..11a8b5c 100644 --- a/internal/tui/view.go +++ b/internal/tui/view.go @@ -495,7 +495,7 @@ func (m Model) footerView() string { if m.dayFilter.Focused() { return footer.Render("filter by date or text • ↑/↓ move • enter open • esc clear") } - return footer.Render("↑/↓ move • enter open • a append • n new day • / filter • r refresh • p project • ? help") + return footer.Render("↑/↓ move • enter open • a append • e edit • y copy • n new day • / filter • r refresh • p project • ? help") } if m.status != "" { From fdff9030723f53d25a1d69dc4a073464313a61e9 Mon Sep 17 00:00:00 2001 From: Nate Meyer <672246+notnmeyer@users.noreply.github.com> Date: Wed, 30 Sep 2026 19:49:01 -0700 Subject: [PATCH 2/2] remove ? from the ledger, does nothing --- internal/tui/update.go | 5 ----- internal/tui/view.go | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/internal/tui/update.go b/internal/tui/update.go index 7b08199..aeeb76d 100644 --- a/internal/tui/update.go +++ b/internal/tui/update.go @@ -372,11 +372,6 @@ func (m Model) onLedgerKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { m.status = "" return m, m.refresh() - case key.Matches(msg, m.keys.Help): - m.help.ShowAll = !m.help.ShowAll - m.layout() - return m, nil - case msg.String() == "n" || key.Matches(msg, m.keys.Search): // both start the filter/new-day prompt in place m.status = "" diff --git a/internal/tui/view.go b/internal/tui/view.go index 11a8b5c..5a8ac57 100644 --- a/internal/tui/view.go +++ b/internal/tui/view.go @@ -495,7 +495,7 @@ func (m Model) footerView() string { if m.dayFilter.Focused() { return footer.Render("filter by date or text • ↑/↓ move • enter open • esc clear") } - return footer.Render("↑/↓ move • enter open • a append • e edit • y copy • n new day • / filter • r refresh • p project • ? help") + return footer.Render("↑/↓ move • enter open • a append • e edit • y copy • n new day • / filter • r refresh • p project") } if m.status != "" {