mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 17:26:21 +00:00
When the cursor lands on entries[0].byte_offset, the !from_start backup logic produces an empty [X, X) range, get_previous_chat returns DB_RESPONSE_EMPTY, the UI sets WIN_SCROLL_REACHED_TOP and never tries again — page-up is permanently stuck. Guard the cursor optimisation with two conditions: index must be non-empty AND cursor must not equal entries[0].byte_offset. When either fails, fall through to the end_time bisect path which correctly locates the byte range with older messages. F16 regression test in bench_failure_modes: without guard: received=200 in 3 iters (premature EMPTY) with guard: received=600 in 7 iters (truly reaches top)