line-read: draw input taller than the screen in part

- input-window chooses the rows to draw: the window stays while the
  cursor is in it and moves the least it must. A marker row at each end
  with hidden rows gives their count.
- The cursor can always go up to the first row drawn, so redrawing no
  longer leaves copies of the input in the scrollback.
- The accepted input is drawn whole.
- layout returns the text of each row.
- New tests: input-window in tests/line.bjo, and tests/tall.bjo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-11-30 21:35:16 +01:00
parent 95d747cf70
commit 566008e264
5 changed files with 181 additions and 25 deletions

View file

@ -228,4 +228,13 @@
(expect "a wide item that does not fit goes to the next row"
(cursor-row-after-reflow [[1 1 1 2] [1]] 1 0 4) 2)
(expect "an empty row is one row" (cursor-row-after-reflow [[] [] [1]] 2 1 4) 2)
;; The rows drawn of an input taller than the screen.
(expect "input that fits is drawn whole" (input-window 5 10 3 0) (Tuple 0 5))
(expect "at the start, a marker below" (input-window 20 6 2 0) (Tuple 0 5))
(expect "at the end, a marker above" (input-window 20 6 19 0) (Tuple 15 5))
(expect "between, a marker each side" (input-window 20 6 10 0) (Tuple 7 4))
(expect "the window stays while the cursor is in it" (input-window 20 6 9 7) (Tuple 7 4))
(expect "and moves the least it must" (input-window 20 6 5 7) (Tuple 5 4))
(expect "a screen of 2 rows has no markers" (input-window 20 2 10 0) (Tuple 9 2))
(println "line ok"))