- Python 97.4%
- Nix 2.6%
|
All checks were successful
ci-tron/test Success
Capture styled text (as_ansi=True) and render it as the base layer; model.py keeps operating on plain text via a new ansi.unstyled() helper, with selection/search highlighting punched in as a separate overwrite. |
||
|---|---|---|
| tests | ||
| .ci-tron.json | ||
| .gitignore | ||
| AGENTS.md | ||
| ansi.py | ||
| CLAUDE.md | ||
| conftest.py | ||
| flake.lock | ||
| flake.nix | ||
| grab.py | ||
| keymap.py | ||
| model.py | ||
| README.md | ||
| ROADMAP.md | ||
| ui.py | ||
pounce
A kitty kitten that reproduces
st's KEYBOARDSELECT_PATCH (reflow variant) keyboard-driven
text selection mode, keybind-for-keybind, so muscle memory carries over between the two
terminals.
Bind it in kitty.conf:
map ctrl+shift+space kitten pounce/grab.py
map ctrl+shift+f kitten pounce/grab.py --search=forward
map ctrl+shift+b kitten pounce/grab.py --search=backward
(pounce/ here is wherever you install this kitten's five files under
~/.config/kitty/; see flake.nix's packages.default for a Nix-built install.)
Layout
model.py— the entire selection/movement/search state machine, in plain Python with nokitty.*imports. Fully unit-tested (tests/).keymap.py— declarative table mapping key presses to the abstract commandsmodel.pyunderstands. Also plain Python, also tested.ansi.py— strips ANSI escape sequences from captured terminal text. Also plain Python, also tested.model.pyonly ever sees the stripped (plain) text;ui.pyrenders the original styled text underneath its own selection/search highlighting, so colors and formatting survive into selection mode.grab.py/ui.py— the kitty-specific glue: capturing the terminal's screen and scrollback, drivingmodel.pyfrom real key events, and rendering. This part isn't covered by the test suite (it needs a real kitty process) and should stay as thin as possible — new behavior belongs inmodel.py, not here.
Known fidelity gap
st's Return copies the selection to the clipboard and leaves it highlighted in the
terminal after exiting keyboard-select mode, because the selection is part of st's own
persistent terminal state. This kitten's selection only exists for the lifetime of its
overlay process, drawn over a static snapshot of the screen — once that process exits there
is no live terminal state left to keep highlighted (kitty gives kittens no way to inject a
persistent selection into a real window). Return here copies and exits, without the
lingering highlight.
Testing
nix develop .#ci --command pytest
CI (ci-tron, see .ci-tron.json) runs the same command on every push.