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:
8 files changed
+238
-44
No files matched your search
@@ -78,6 +78,19 @@ class TestClipboardHistory(BaseTest):
|
||||
self.ae(h.search('mkb'), ('make build',))
|
||||
self.ae(h.search('zzz'), ())
|
||||
|
||||
def test_entries_carry_the_time_they_were_copied(self) -> None:
|
||||
h = ClipboardHistory()
|
||||
self.assertTrue(h.add('first', timestamp=100.0))
|
||||
self.assertTrue(h.add('second', timestamp=200.0))
|
||||
self.ae(h.entries(), ('second', 'first'))
|
||||
self.ae(h.entries_with_times(), (('second', 200.0), ('first', 100.0)))
|
||||
# A repeated copy moves the text and its new time to the top
|
||||
self.assertTrue(h.add('first', timestamp=300.0))
|
||||
self.ae(h.entries(), ('first', 'second'))
|
||||
self.ae(h.entries_with_times(), (('first', 300.0), ('second', 200.0)))
|
||||
self.ae(h.search_with_times('sec'), (('second', 200.0),))
|
||||
self.ae(h.search('sec'), ('second',))
|
||||
|
||||
def test_substring_matches_rank_before_subsequences(self) -> None:
|
||||
h = ClipboardHistory()
|
||||
h.add('xkcd')
|
||||
|
||||
Reference in new issue
Block a user