journal: speak the page text, not just the entry title

Opening the journal and selecting an entry announced its title and stopped,
which is an index into content the player could never reach. Page flipping was
silent too.

The screen is three widgets at once: the tab row (q/e), the list of entry
titles down the left (up/down), and the page on the right holding the actual
text (left/right). The descriptor read only the first two.

It now reads options[selectedOption].pages[selectedPageId] and speaks its text
blocks. A page is bounded by what fits on screen, so it is safe as a single
utterance. Layout newlines are flattened first -- splitTextByPages joins the
game's own wrapped lines with \n, so left in they make the reader pause
mid-sentence at every wrap point. Page position is announced only when there is
more than one page, and the blocks are pushed into the console history so [ and
] walk back through a long lore entry after the utterance has gone by.

The tab leads only when the tab changed and the title only when the entry
changed, so flipping pages does not bury the new page under a repeated heading.

That suppression made read() stateful, which is a trap: it is called for the
same focus from four places -- the per-frame poll, the post-keypress announce,
repeatFocus, and the testbed's before/after probes -- so a poll would consume
the "changed" flag and the real announcement would come out headless. The
descriptor now caches its last (key, text) and replays it whenever the key is
unchanged, making read() idempotent; the suppression state advances exactly
once per genuine focus change.

Adds a generic descriptor.reset hook, called from menus.announceScreen. The
memory lives in file-locals that outlive the screen, so without it reopening
the journal on the entry you left it on would read the page with no title.

Testbed asserts the spoken text contains the page body rather than merely being
non-nil. 29 checks, 0 failures.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Accessibility Mod
2026-08-02 01:04:03 +02:00
co-authored by Claude Opus 5
parent 81a209b600
commit e1d9995c9f
5 changed files with 236 additions and 21 deletions
+20
View File
@@ -96,6 +96,26 @@ genuinely stops being visible.
The tracker only ever reports things you have actually seen.
### The journal (`j`)
The journal has three parts, and all three are spoken:
| Key | Moves |
|---|---|
| `q` / `e` | Between tabs — Quests, Lore, Bestiary, Components, Recipes, Tutorials |
| Up / Down | Between entries in the current tab |
| Left / Right | Between pages of the selected entry |
Selecting an entry reads its title, its position in the list, and then the text
of the page itself. The tab name is only spoken when you change tabs, and the
title only when you change entry, so flipping pages doesn't make you sit through
the heading again.
Long entries run to several pages; you are told `page 2 of 3` when there is more
than one. The page text also goes into the message history, so `[` and `]` will
walk back through it and `\` re-reads a line — useful for a long lore entry you
want to take in a piece at a time.
### Your character
| Key | Action |