feat(clipboard): show the paste target and navigate the history picker

The clipboard history picker listed the entries without saying when they
were copied or which window would receive the paste, and the only way to
pick an entry was to read its hint label and type the letters, which the
picker never showed.

Each entry now carries the time it was copied and the window that will be
pasted into is named above the list, with a footer documenting the keys.
Pressing Up/Down moves the highlighted entry and Enter pastes it, through a
new --pick-from-list mode of the hints kitten that keeps the hint letters
working as before.

Fixes #49
This commit is contained in:
BlackAngelTV committed 2026-12-03 11:01:11 +01:00
1 parent 1b9e076139
commit 42c097c69a
8 files changed
+238 -44

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
// License: GPLv3 Copyright: 2026, Kovid Goyal, <kovid at kovidgoyal.net>
package hints
import "testing"
func TestNextSelection(t *testing.T) {
cases := []struct {
pos, marks, delta, expected int
}{
// Nothing selected yet: down selects the first choice, up the last one
{-1, 3, 0, 0},
{-1, 3, 1, 0},
{-1, 3, -1, 2},
// Moving past either end wraps around
{0, 3, 1, 1},
{2, 3, 1, 0},
{0, 3, -1, 2},
{1, 1, 2, 0},
{0, 3, 4, 1},
{0, 3, -4, 2},
// A stale position falls back to the first choice
{5, 3, 1, 0},
// An empty list has nothing to select
{-1, 0, 1, -1},
{0, 0, -1, -1},
}
for _, c := range cases {
if got := next_selection(c.pos, c.marks, c.delta); got != c.expected {
t.Fatalf("next_selection(%d, %d, %d) = %d, expected %d", c.pos, c.marks, c.delta, got, c.expected)
}
}
}