diff options
| author | user <user@clank> | 2026-07-16 16:40:45 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-16 16:40:45 +0200 |
| commit | 2f43a8851a89661b304edd9396677080dcb3e003 (patch) | |
| tree | bf74d012a5646cb08e1c49fb9c5c107b154a11b5 /src/osk.asm | |
| parent | term/osk: scroll region so the OSK never hides the input line (diff) | |
| download | gbos-2f43a8851a89661b304edd9396677080dcb3e003.tar.gz gbos-2f43a8851a89661b304edd9396677080dcb3e003.tar.xz gbos-2f43a8851a89661b304edd9396677080dcb3e003.zip | |
term/osk: view-offset scroll region (lossless backlog on OSK toggle)
Replace the shrink-and-scroll region with a view offset. The terminal is
always 18 logical rows; term_write_tilemap maps screen row -> logical row +
wViewTop (rows the OSK covers clamp to the cursor line). Showing the OSK
sets the offset to OSK_ROWS so the cursor line lands at row 14 (above the
keyboard) and hiding it sets the offset back to 0 - now purely a remap, so
nothing is scrolled off or destroyed. term_set_view replaces term_set_rows;
term_scroll/cursor_down are back to plain 18-row scrolling.
Result: full 18-row backlog when the OSK is hidden, a shifted 15-row window
when shown, and toggling is lossless (verified: OSK-shown view == baseline
rows 3..17, and toggle on+off == baseline exactly).
Diffstat (limited to '')
| -rw-r--r-- | src/osk.asm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/osk.asm b/src/osk.asm index a34a863..5e316e3 100644 --- a/src/osk.asm +++ b/src/osk.asm @@ -236,9 +236,9 @@ osk_toggle:: ld [wOskVisible], a or a jr z, .hide - ; show: shrink the terminal to the rows above the keyboard, then enable window - ld a, 18 - OSK_ROWS - call term_set_rows + ; show: shift the view up so the cursor line clears the keyboard + ld a, OSK_ROWS + call term_set_view ld a, [rLCDC] or %00100000 ld [rLCDC], a @@ -247,8 +247,8 @@ osk_toggle:: ld a, [rLCDC] and %11011111 ld [rLCDC], a - ld a, 18 ; restore full-height terminal - call term_set_rows + xor a ; view unshifted -> full 18-row backlog + call term_set_view ret ; movement with wrap-around; each moves the highlight |
