feat(clipboard): add an in-memory clipboard history with search and paste #41

Closed
BlackAngelTV wants to merge 27 commits from feat/clipboard-history into main
pull from: feat/clipboard-history
Owner

Objectif

Répond à l'issue #26 : garder un historique local du presse-papiers, consultable et réinsérable, sans jamais toucher au disque.

Raccourcis par défaut

  • :kbd:kitty_mod+alt+v → paste_from_clipboard_history
  • :kbd:kitty_mod+alt+f → search_clipboard_history

kitty_mod valant ctrl+shift par défaut, les combinaisons réelles sont ctrl+shift+alt+v et ctrl+shift+alt+f. Les versions kitty_mod+shift+… ont été écartées : kitty_mod contient déjà shift, elles se résolvaient sur les mêmes touches que paste_from_clipboard et move_window_forward.

Changements

  • kitty/clipboard_history.py : anneau mémoire borné (50 entrées, 64 Kio par entrée, 1 Mio au total), dédoublonnage par remontée en tête, recherche floue (sous-chaîne avant sous-séquence), extraction du texte depuis bytes ou un chunker.
  • Alimentation à chaque écriture text/plain du presse-papiers ; sélection primaire et données non textuelles ignorées ; écritures OSC 5522 avec pw marquées privées et jamais enregistrées.
  • Deux actions (liste numérotée, Échap annule ; recherche floue d'abord), mappées par défaut.
  • kitty/options/types.py et to-c-generated.h régénérés (le générateur a été réparé pour accepter les parsers builtin) afin que les mappages soient actifs.
  • Documentation docs/clipboard.rst + docs/changelog.rst.

Vérifications

  • Tests unitaires kitty_tests/clipboard_history.py + tests presse-papiers existants : OK ; suite complète : OK (skipped=11).
  • Mappages vérifiés en chargeant une configuration vide : les deux actions sont dans le keymap par défaut (CLIPBOARD_MAPPINGS_LOAD_OK).
  • Test sur l'application (X11, instance isolée) : copie OSC 52 → picker, sélection, collage dans la fenêtre d'origine ; copie privée absente ; recherche floue OK ; rien sur disque ; historique vide après redémarrage.

Limites connues

  • Tailles fixes (constantes du module) plutôt qu'options de configuration.
  • Sélection par le numéro affiché (interface de choix de kitty), pas par Entrée.

Fixes #26

## Objectif Répond à l'issue #26 : garder un historique local du presse-papiers, consultable et réinsérable, sans jamais toucher au disque. ## Raccourcis par défaut - :kbd:`kitty_mod+alt+v` → `paste_from_clipboard_history` - :kbd:`kitty_mod+alt+f` → `search_clipboard_history` `kitty_mod` valant `ctrl+shift` par défaut, les combinaisons réelles sont `ctrl+shift+alt+v` et `ctrl+shift+alt+f`. Les versions `kitty_mod+shift+…` ont été écartées : `kitty_mod` contient déjà `shift`, elles se résolvaient sur les mêmes touches que `paste_from_clipboard` et `move_window_forward`. ## Changements - `kitty/clipboard_history.py` : anneau mémoire borné (50 entrées, 64 Kio par entrée, 1 Mio au total), dédoublonnage par remontée en tête, recherche floue (sous-chaîne avant sous-séquence), extraction du texte depuis `bytes` ou un chunker. - Alimentation à chaque écriture `text/plain` du presse-papiers ; sélection primaire et données non textuelles ignorées ; écritures OSC 5522 avec `pw` marquées privées et jamais enregistrées. - Deux actions (liste numérotée, `Échap` annule ; recherche floue d'abord), mappées par défaut. - `kitty/options/types.py` et `to-c-generated.h` régénérés (le générateur a été réparé pour accepter les parsers builtin) afin que les mappages soient actifs. - Documentation `docs/clipboard.rst` + `docs/changelog.rst`. ## Vérifications - Tests unitaires `kitty_tests/clipboard_history.py` + tests presse-papiers existants : OK ; suite complète : `OK (skipped=11)`. - Mappages vérifiés en chargeant une configuration vide : les deux actions sont dans le keymap par défaut (`CLIPBOARD_MAPPINGS_LOAD_OK`). - Test sur l'application (X11, instance isolée) : copie OSC 52 → picker, sélection, collage dans la fenêtre d'origine ; copie privée absente ; recherche floue OK ; rien sur disque ; historique vide après redémarrage. ## Limites connues - Tailles fixes (constantes du module) plutôt qu'options de configuration. - Sélection par le numéro affiché (interface de choix de kitty), pas par `Entrée`. Fixes #26
BlackAngelTV added 3 commits 2026-11-11 21:05:45 +01:00
Users need to know the history is memory only and how to bind the two new
actions, since nothing is mapped by default and unrecorded clipboard content
would otherwise look like a bug.
BlackAngelTV added 3 commits 2026-11-11 21:32:13 +01:00
OSC 52 writes are committed as a chunker factory rather than bytes, so the
history silently dropped every text copy made by a program. Extract the text
from either representation, bounded so a huge write is not materialized.
The picker overlay is the active window while it is open, so pasting into the
active window after a selection went nowhere once it closed. Remember the
window the user was working in before showing the list.
The list is selected by typing the number shown next to an entry, which is not
discoverable from the list alone.
BlackAngelTV added 1 commit 2026-11-11 21:36:38 +01:00
Without a default shortcut the history was effectively undiscoverable, unlike
every other clipboard action. Use kitty_mod+shift+v for the history and
kitty_mod+shift+f for the fuzzy search, both keys being unused.
BlackAngelTV added 2 commits 2026-11-11 21:39:52 +01:00
auto_reload_config is parsed with the builtin float, which the generator
rejected because it only accepted Python functions, so regenerating the option
types after any change to the defaults was impossible.
kitty_mod already includes shift, so kitty_mod+shift+v resolved to the same
chord as paste_from_clipboard and the mapping did nothing. Use the free alt
combinations and regenerate the option types so the bindings are part of the
default configuration.
BlackAngelTV closed this pull request 2026-11-12 07:30:31 +01:00
BlackAngelTV deleted branch feat/clipboard-history 2026-11-12 07:33:02 +01:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FWS/FWS-Kitty#41