More flat review improvement.
This commit is contained in:
1 parent
50e32f24df
commit
e88de5ee66
41 files changed
+2167
-73
No files matched your search
@@ -0,0 +1,44 @@
|
||||
# Current-line command
|
||||
|
||||
Cthulhu+Shift+Up reads the entire current line. Two presses within 500 ms spell
|
||||
it; three use phonetics. Both desktop and laptop layouts use the same binding.
|
||||
It follows NVDA's `script_reportCurrentLine` in `source/globalCommands.py`:
|
||||
native caret outside browse mode, browse cursor inside it. It does not replay
|
||||
the previous utterance or use the flat-review position.
|
||||
|
||||
Automated checks:
|
||||
|
||||
```sh
|
||||
go test ./internal/input ./internal/review ./internal/app -run 'Test(CurrentLine|CommandRuntimeRoutesFocusPresentationRequests|ReviewMultiPressSequences)' -count=1
|
||||
python3 tests/native_test_session.py env CTHULHU_NATIVE_CURRENT_LINE=1 go test ./internal/atspi -run '^TestNativeCurrentLine$' -count=1 -v
|
||||
```
|
||||
|
||||
The private GTK fixture checks Unicode, a caret in the middle of a line, the
|
||||
end of text, empty controls, blank lines, a trailing newline, password exclusion,
|
||||
non-text control labels and rejection of stale focus. It verifies native caret
|
||||
offsets after reading. Worker tests check whole browse lines and multiple inline
|
||||
fragments, preserving the browse position. Existing flat-review and Say All tests
|
||||
cover the shared line-reading and multi-press helpers.
|
||||
|
||||
Live acceptance after a normal rebuild and reload:
|
||||
|
||||
1. In a native multiline editor, enter `First line`, `Second café`, an empty line
|
||||
and `Last line`. Put the caret in the middle of the second line. Press
|
||||
Cthulhu+Shift+Up: expect the whole second line. Press Left afterward to verify
|
||||
that the caret did not move. Check the blank line and the end of the last line.
|
||||
2. Double and triple press to check spelling and phonetics. Pause longer than
|
||||
500 ms and verify the next press reads normally. Check both keyboard layouts.
|
||||
3. Move flat review to a different line. The new command should still read the
|
||||
application caret line; Numpad 8 or Cthulhu+I should retain the review position.
|
||||
4. In a browser, move into the middle of a line using browse arrows. Check the
|
||||
whole line, including inline text fragments, and verify the next arrow
|
||||
continues from the previous position. In a focused editable field, check the
|
||||
native caret instead. Try another tab or window while a report is pending.
|
||||
5. Check a FastSMRW table cell and a button. Check that password contents remain
|
||||
silent and unavailable text gives explicit failure feedback. Cthulhu+Up must
|
||||
still increase the selected speech setting. Check Say All and Numpad 8's
|
||||
spelling behavior for regressions.
|
||||
|
||||
These automated checks do not establish audible output, physical key routing or
|
||||
Braille behavior. The native implementation uses AT-SPI; Wine Access does not
|
||||
currently expose this focused-line operation.
|
||||
@@ -0,0 +1,206 @@
|
||||
# Flat-review robustness comparison
|
||||
|
||||
Review date: 2026-10-21. Cthulhu baseline: `testing` at `50e32f2`.
|
||||
Orca reference: upstream `main` at
|
||||
`828eaf2e70d7b88124b10b3a6b2daa792ab266c7`. The local Orca checkout was
|
||||
older; fetching the current reference confirmed that the three source files
|
||||
below have no changes between those revisions.
|
||||
|
||||
This is a source comparison and a set of verified capture and recovery repairs.
|
||||
It does not establish complete Orca parity or resolve every user report.
|
||||
At the initial comparison, the available local log contained one
|
||||
`accessible object not found` flat-review failure without enough evidence to
|
||||
identify its cause, and no instance of the reported text-limit failure. Older diagnostic logs describe
|
||||
provider timeouts already addressed by earlier capture work; they are not proof
|
||||
of a remaining timeout in the current build.
|
||||
|
||||
## What Orca does
|
||||
|
||||
Orca's [Flat Review documentation](https://help.gnome.org/orca/howto_flat_review.html)
|
||||
describes a spatial representation of the active window's visible contents.
|
||||
The implementation separates finding on-screen objects, finding visible lines,
|
||||
and building review zones:
|
||||
|
||||
- [`flat_review.py`](https://gitlab.gnome.org/GNOME/orca/-/blob/828eaf2e70d7b88124b10b3a6b2daa792ab266c7/src/orca/flat_review.py):
|
||||
`Context` chooses a dialog/frame or an explicit root and restricts to an active
|
||||
menu when appropriate. `_get_zones_from_text` clips to a scroll pane/document,
|
||||
gets visible lines, removes embedded-object characters, and builds text zones.
|
||||
Word and character objects are created on demand. `_find_zone_with_object`
|
||||
can use a parent or child when the exact focused object was pruned.
|
||||
- [`ax_utilities.py`](https://gitlab.gnome.org/GNOME/orca/-/blob/828eaf2e70d7b88124b10b3a6b2daa792ab266c7/src/orca/ax_utilities.py):
|
||||
`_get_on_screen_objects` checks showing/visible state and window intersection,
|
||||
treats suitable controls as leaves, enumerates visible table cells, and
|
||||
suppresses some duplicate container text. Invalid component geometry is not
|
||||
invariably treated as off-screen.
|
||||
- [`ax_utilities_text.py`](https://gitlab.gnome.org/GNOME/orca/-/blob/828eaf2e70d7b88124b10b3a6b2daa792ab266c7/src/orca/ax_utilities_text.py):
|
||||
`find_first_visible_line` searches by line rectangles, then `get_visible_lines`
|
||||
walks forward until below the viewport. Invalid line offsets have explicit
|
||||
handling. This differs from requiring usable character geometry to find a
|
||||
large object's viewport.
|
||||
|
||||
These paths do not impose Cthulhu's 256-range/65,536-character object budgets.
|
||||
That is not evidence that unlimited capture is safe: Cthulhu still needs bounded
|
||||
native calls, memory use, cancellation, and protection from defective providers.
|
||||
Orca also has its own tradeoffs: the single-line editable-text path requests all
|
||||
text, and `Context.is_stale` itself only checks top-level size changes. Presenter
|
||||
event handling supplies additional context management. Copying one function
|
||||
alone would not reproduce that behavior.
|
||||
|
||||
## Comparison and priorities
|
||||
|
||||
| Area | Current Cthulhu behavior | Assessment |
|
||||
| --- | --- | --- |
|
||||
| Scope | Captures the focused window/menu/dialog and skips hidden descendants during review-only traversal. | Already aligned in principle. Preserve foreground ownership and popup handling. |
|
||||
| Large GTK tables | Captures visible selectable-table cells and headers; keeps a selected-cell identity anchor. | Already follows Orca's viewport approach. Existing table checks remain relevant. |
|
||||
| Clipped text ranges | Previously emitted one range per clipped visible character. | Confirmed defect; repaired here. Count contiguous visible spans against the range budget. |
|
||||
| Viewport discovery | Uses character rectangles first; large objects can use a bounded binary search over line rectangles. | Private GTK coverage seeks into a 101000-character scrolled object with unavailable character rectangles. Small objects keep their existing bounded path. |
|
||||
| Long horizontal lines | Oversized viewport intervals use glyph locations and bounded text retrieval; oversized native line responses also enter that path. | A real GTK 100000-character line is captured without increasing the character budget. New text requests contain at most 128 characters. Sparse or defective point providers remain bounded and explicitly limited. |
|
||||
| Failure scope | Known unavailable text objects and failed child enumeration retain healthy content with explicit completeness counts. | A partial result announces a speech and Braille warning on entry or a changed omission count. Its line boundaries say top/bottom of available content. Root failure, cancellation, stale snapshots, invalid trees, and aggregate layout limits still fail the operation. |
|
||||
| Focus anchoring | Tries exact focus, displayed descendants, then the nearest displayed ancestor within the review root. | A targeted fixture proves pruned focus stays on its parent text rather than an unrelated first line. Preserved position still uses object generations and native offsets. |
|
||||
| Updates and cancellation | Cthulhu refreshes owned layout per command and rejects stale results; native capture and queues are bounded. | Preserve these safeguards. Snapshot refresh, provider timeout, and audible responsiveness are separate concerns. |
|
||||
| Diagnostics | Capture timings include `text_issues` counts for viewport, character, range, tree-byte, query-budget, and provider failures. Partial presentation logs omission counts. | These fields contain no accessible text or names. A wholly limited window retains its existing spoken text-limit message. |
|
||||
|
||||
The line-based discovery, long-line retrieval, explicit partial recovery, and
|
||||
parent anchoring above are implemented in the current working tree. Capture
|
||||
budgets, provider-call chunking, cancellation, foreground ownership, and stale
|
||||
result rejection remain in force. Remaining failures need an application,
|
||||
triggering command, build revision, and fresh failure/timing record before
|
||||
assigning a cause. Cold-capture latency remains separate from cached navigation.
|
||||
|
||||
## Repair and evidence
|
||||
|
||||
`internal/atspi/text.go` now accumulates adjacent visible characters with the
|
||||
same row geometry into one range. It preserves exact Unicode offsets and unions
|
||||
only their clipped rectangles. A hidden offset, embedded object, or row change
|
||||
prevents merging across that boundary. The 128-character geometry blocks and
|
||||
all existing capture budgets remain in force. No new mutable cross-command state
|
||||
is introduced; span accumulation belongs to one synchronous capture.
|
||||
|
||||
Before the change, a real GTK label with 20 horizontally clipped lines produced
|
||||
`VisibleText{Limited: true}`. After the change, the same fixture captures more
|
||||
than 256 characters in at most 21 spans. A deterministic fixture verifies 800
|
||||
Unicode characters in 20 spans, exact offsets, and clipping at both edges. Other
|
||||
regressions cover a span crossing geometry blocks, disjoint bidirectional runs,
|
||||
and a genuinely excessive number of separate visible spans. Existing tests
|
||||
cover blank rows, embedded objects, large terminals, cancellation and malformed
|
||||
provider data.
|
||||
|
||||
The successful four-row capture benchmark, three runs per version, measured
|
||||
14.6–15.1 microseconds and 180 allocations before, versus 10.4–10.7 microseconds
|
||||
and 19 allocations after. Allocated bytes fell from 19,664 to 4,048 per capture.
|
||||
This measures local layout preparation with a synthetic provider; it does not
|
||||
measure AT-SPI round trips or prove live speech latency.
|
||||
|
||||
## Automated checks
|
||||
|
||||
```sh
|
||||
go test ./... -count=1
|
||||
go test -race ./internal/atspi ./internal/review ./internal/app ./internal/presentation -count=1
|
||||
go vet ./internal/atspi ./internal/review ./internal/app ./internal/presentation
|
||||
python3 tests/native_atspi.py
|
||||
python3 tests/native_test_session.py env CTHULHU_NATIVE_REVIEW_CLIPPED=1 CTHULHU_NATIVE_REVIEW_CACHE=1 CTHULHU_NATIVE_REVIEW_BOUNDS=1 go test ./internal/atspi -run '^TestNativeFlatReview(ClippedViewport|PreservesProviderCache|BoundsSlowLongRanges)$' -count=1 -v
|
||||
go test ./internal/atspi -run '^$' -bench '^BenchmarkCaptureVisibleTextClipped$' -benchmem -count=3
|
||||
```
|
||||
|
||||
Use a writable `GOCACHE` if required by the environment. Native harnesses create
|
||||
private Xvfb/D-Bus/AT-SPI sessions and do not replace the running reader.
|
||||
All checks above passed for this change. The existing table harness emitted
|
||||
GTK `Atk-CRITICAL` object-role warnings while its assertions passed; the cause
|
||||
of those warnings was not investigated here.
|
||||
|
||||
## Follow-up implementation and evidence
|
||||
|
||||
Large-object line discovery moves by validated complete line boundaries during
|
||||
binary search; it never scans terminal scrollback. Oversized horizontal text
|
||||
uses native offset-at-point and glyph rectangles to discover visible offsets,
|
||||
then reads text in spans of at most 128 characters. Offsets are sorted before
|
||||
capture so bidirectional runs retain exact logical identities. Point traversal
|
||||
has a 4096-query budget; it checks gaps before skipping vertically so an inset
|
||||
or shorter glyph is not missed. Ordinary clipped capture continues to use bounded
|
||||
geometry blocks. Unsupported or excessive work yields an explicit limitation,
|
||||
not guessed text. No global capture limit was increased.
|
||||
|
||||
A native provider may return a zero-area rectangle for a nonvisible glyph.
|
||||
That is distinct from a failed native request. Such glyphs now break visible
|
||||
spans instead of discarding the entire object's usable text. Unavailable whole
|
||||
line geometry remains an unavailable capture. A private GTK fixture injects a
|
||||
zero-area glyph and verifies that the surrounding visible text survives and
|
||||
the missing offset is excluded. Combining marks and joiners attached to a
|
||||
visible base retain their Unicode offsets even without independent rectangles.
|
||||
Bounded endpoint lookup also handles a huge line ending in a zero-area newline.
|
||||
|
||||
`ChildrenUnavailable` is capture-owned state copied into the owned tree and
|
||||
atomic review snapshot. Recovery is restricted to review-only child enumeration;
|
||||
root enumeration failure and cancellation remain fatal. `FlatCompleteness`
|
||||
travels with each worker result. No partial object's accessible name is silently
|
||||
substituted for its missing text. A warning is announced when entering a partial
|
||||
layout or when its omission counts change; returning to a complete layout clears
|
||||
that warning state. Ordinary invalidation triggers recapture as before; there
|
||||
is no broad automatic retry loop. The warning uses the existing system-message
|
||||
output path for both speech and Braille, while spelling retains its own request.
|
||||
|
||||
Seven private native cases cover cache reuse, bounded geometry, clipped spans,
|
||||
a 100000-character horizontal line, scrolled line-only geometry, unavailable
|
||||
child enumeration, and zero-area glyphs. Additional worker and presentation
|
||||
fixtures cover healthy-content recovery, omission counts, recovery to a complete
|
||||
layout, ancestor anchoring, spelling, Braille warning delivery, and incomplete
|
||||
boundary feedback. Run native modes in separate processes:
|
||||
|
||||
```sh
|
||||
python3 tests/native_test_session.py env CTHULHU_NATIVE_REVIEW_VIEWPORT=1 CTHULHU_NATIVE_REVIEW_VIEWPORT_MODE=long go test ./internal/atspi -run '^TestNativeFlatReviewLargeTextViewport$' -count=1 -v
|
||||
python3 tests/native_test_session.py env CTHULHU_NATIVE_REVIEW_VIEWPORT=1 CTHULHU_NATIVE_REVIEW_VIEWPORT_MODE=lines go test ./internal/atspi -run '^TestNativeFlatReviewLargeTextViewport$' -count=1 -v
|
||||
python3 tests/native_test_session.py env CTHULHU_NATIVE_REVIEW_SUBTREE=1 go test ./internal/atspi -run '^TestNativeFlatReviewUnavailableSubtree$' -count=1 -v
|
||||
python3 tests/native_test_session.py env CTHULHU_NATIVE_REVIEW_GLYPHS=1 go test ./internal/atspi -run '^TestNativeFlatReviewZeroAreaGlyph$' -count=1 -v
|
||||
```
|
||||
|
||||
A read-only probe of the open FastSMRW instance exposed zero-area glyph failures
|
||||
that previously left visible table-cell text unavailable. After the repair,
|
||||
27 worker commands across line, word, character, window-start, and window-end
|
||||
review passed with zero reported omissions. Cached commands took about 0.3-0.7
|
||||
milliseconds. Initial capture still took about eight seconds, mostly in visible
|
||||
text. The standalone probe had no retained native focus event and reported
|
||||
`root_scope=desktop` while filtering capture to FastSMRW's provider; this timing
|
||||
does not establish normal foreground reader latency. No application keys were
|
||||
injected and the running reader was not replaced. These results do not establish
|
||||
audible speech or physical Braille acceptance.
|
||||
|
||||
### Follow-up check results
|
||||
|
||||
The full Go suite, affected-package race tests, vet, command builds, parity
|
||||
ledger validation, recorded-speech checks, and all seven targeted native GTK
|
||||
cases passed. The broad `tests/native_atspi.py` harness initially failed
|
||||
`TestNativeGUIListTableSpeech` because the launcher description was repeated.
|
||||
The isolated table checks passed on both an untouched `50e32f2` snapshot and the
|
||||
changed tree, and a subsequent complete harness run passed. The initial failure
|
||||
was not explained; passing reruns do not establish that this startup/event-order
|
||||
behavior is stable. Existing GTK `Atk-CRITICAL` role warnings also remain.
|
||||
|
||||
## Human review and live acceptance
|
||||
|
||||
Review the generated diff before submission. With an authorized build/restart:
|
||||
|
||||
1. In a native editor or a window containing a wide multiline text control,
|
||||
horizontally scroll so multiple lines are clipped. Review lines, words, and
|
||||
characters forward and backward; visible text must remain available when
|
||||
the total exceeds 256 characters. Repeat after resizing and scrolling. Check
|
||||
the first and last partially visible characters and Unicode offsets.
|
||||
2. Review ordinary and large terminal screens, blank rows, and a large file in
|
||||
a terminal editor. Check Numpad 7/8/9, 4/5/6 and 1/2/3, window start/end,
|
||||
explicit top/bottom feedback, and multi-press spelling.
|
||||
3. Check a browser with horizontally clipped text and embedded links, a GTK
|
||||
table such as a timeline, a preferences notebook, and a popup menu. Hidden
|
||||
letters and embedded-object placeholders must not be spoken as ordinary text.
|
||||
Password contents must stay excluded. Review must stay in the foreground
|
||||
window and ordinary focus/caret navigation must still work afterward.
|
||||
4. Exercise a window with one unavailable text object or child subtree. Healthy
|
||||
content must remain reviewable with an explicit warning. Repeated navigation
|
||||
should not repeat the warning continuously; after the provider recovers and
|
||||
the tree is refreshed, ordinary top/bottom feedback must return.
|
||||
5. Confirm audible speech and physical Braille separately, including routing
|
||||
within a merged span. Native capture and Go test success do not establish
|
||||
these outcomes. Preserve fresh logs for any remaining failure.
|
||||
|
||||
The code change affects shared visible-text capture used in owned trees;
|
||||
terminal, browser, mouse-review, and Braille consumers can therefore be affected
|
||||
indirectly. It changes neither X11 key grabs nor foreground ownership. Wayland
|
||||
live acceptance remains separate.
|
||||
Reference in new issue
Block a user