kitty/kittens/ask
Kovid Goyal a1085a78c3
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
ask kitten: Fix clicks hitting the wrong choice when the dialog does not fit
The dialog was drawn by writing newlines and relying on the terminal to
wrap long lines, recording clickable ranges assuming nothing scrolled or
wrapped. When the content was taller than the window, the screen
scrolled and every clickable range was off by the scroll amount.

Now the full layout is computed up front, with clickable ranges relative
to it, and rows are drawn with absolute cursor positioning and line
wrapping disabled, so the terminal never scrolls or wraps. The boxed
choice layout is used only if it fits entirely, otherwise the compact
one is used, and if even that does not fit, the content is bottom
aligned so the choices remain visible. Choices too wide for the screen
are truncated with an ellipsis.

Also fix:
 - The hidden text placeholder not being clickable when it wraps over
   multiple lines, its clickable range going stale after a resize, and
   its range including one cell too many.
 - Compact choice ranges being computed by iterating over a map, putting
   them in random order when several choices share a line.
 - An empty box row or compact row being output when the first choice is
   wider than the screen.
 - truncate_at_space using a cell width as a byte offset, splitting
   multi-byte characters, and looping forever when a character is wider
   than the available width.

Closes #10883
2026-11-17 19:26:38 +05:30
..
__init__.py
choices.go ask kitten: Fix clicks hitting the wrong choice when the dialog does not fit 2026-11-17 19:26:38 +05:30
choices_test.go ask kitten: Fix clicks hitting the wrong choice when the dialog does not fit 2026-11-17 19:26:38 +05:30
get_line.go
main.go
main.py