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
@@ -66,6 +66,24 @@ func rune_to_index_map(alphabet string) *map[rune]int {
|
||||
return &runeToIndexMap
|
||||
}
|
||||
|
||||
// next_selection moves pos by delta positions in a list of marks choices,
|
||||
// wrapping around, as the arrow keys do in the list picker. A negative pos,
|
||||
// meaning nothing is selected yet, selects the first choice when moving down
|
||||
// and the last one when moving up, and a stale pos falls back to the first
|
||||
// choice so that the arrow keys never stop working.
|
||||
func next_selection(pos, marks, delta int) int {
|
||||
if marks < 1 {
|
||||
return -1
|
||||
}
|
||||
if pos < 0 || pos >= marks {
|
||||
if delta < 0 {
|
||||
return marks - 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
return ((pos+delta)%marks + marks) % marks
|
||||
}
|
||||
|
||||
// decode_hint converts a hint to its corresponding index as it would appear in
|
||||
// the breadth-first traversal of the prefix tree generated by the given
|
||||
// alphabet.
|
||||
|
||||
Reference in new issue
Block a user