Skip to content

Preview page readout works on the pane that ships - #689

Merged
GoKubar merged 1 commit into
mainfrom
preview-page-indicator
Sep 16, 2026
Merged

GoKubar merged 1 commit into
mainfrom
preview-page-indicator

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Nobody running the default has seen a page number in the preview. Two
independent reasons, both dating from when the v2 pane became the default:

  1. The readout was gated if !model.previewV2, chrome.hasResult, and
    previewV2 defaults true (FLASHTEX_PREVIEW_V2=0 opts out). The whole
    block was dead on the shipped configuration.
  2. toolbarPageCount read result?.pages.count. The v2 route asks for
    display-list-v2-only, so a live reply carries no v1 pages — the count
    was 0, and the readout would have shown 1 / 1 even had it rendered.

Either one alone hides the page number; both were present.

What changed

currentPage was a @State in PreviewPane written only by the v1 pane's
onVisiblePage. The v2 pane routes its scroll anchor to
v2WindowSawVisiblePage, which never touched it. That state moves to
ShellModel.previewVisiblePage, written by both panes, so one readout serves
whichever pane is on screen.

toolbarPageCount now counts the display list's pages when there is a frame,
falling back to the v1 result otherwise. A windowed frame still lists every
page of the document (non-resident entries carry no items), so the total is the
document's real length rather than the resident window — which is what a reader
wants from "page 12 of 340".

It stays in the transient hover HUD (#653/#666 treatment): no permanent header
row, no floating percentage over the page.

toolbarPageCount had exactly one consumer left after #671 removed
PrintController's use, so redefining it is contained.

Verification

Full suite with --skip IMECompositionTests on this branch and on its merge
base, run back to back under the fleet lock with real Rust release binaries, so
the comparison is like-for-like. That class aborts the Mac suite
nondeterministically at test 668 of ~1400 (#681); it predates this work and
stops the suite for everyone, so a complete run is unavailable to any branch
right now — see #680 for the false-green that abort produces.

Includes a regression test that pins both halves: the count follows the display
list when v1 pages are elided, previewVisiblePage tracks the pane's anchor,
and the readout is no longer gated on !previewV2.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

Nobody running the default has seen a page number. Two independent reasons, both
introduced when the v2 pane became the default:

- The readout was gated `if !model.previewV2, chrome.hasResult`, and `previewV2`
  defaults true (`FLASHTEX_PREVIEW_V2=0` opts out), so the whole block was dead
  on the shipped configuration.
- `toolbarPageCount` read `result?.pages.count`. The v2 route asks for
  `display-list-v2-only`, so a live reply carries no v1 pages and the count was
  0 — the readout would have shown `1 / 1` even had it rendered.

`currentPage` was also a `@State` in `PreviewPane` written only by the v1 pane's
`onVisiblePage`; the v2 pane routes its anchor to `v2WindowSawVisiblePage`, which
never touched it. That moves to `ShellModel.previewVisiblePage`, written by both
panes, so one readout serves whichever pane is on screen.

`toolbarPageCount` now counts the display list's pages when there is a frame. A
windowed frame still lists every page of the document (non-resident ones carry no
items), so the total is the document's real length rather than the resident
window.

Implementation-Agent: claude-opus-5 (export-consolidation lane)
Commit-Executor: claude-opus-5 direct git (Cursor usage limit)
Co-authored-by: GoKubar <[email protected]>
GoKubar added a commit that referenced this pull request Sep 16, 2026
…#692)

The successor Commander needs this and it existed only in a scratchpad.

Records: what landed (119 commits, 33 PRs, backlog 219 -> 66, branches 540 ->
182), what is NOT released (v0.1.5 = `fe9bc430`, 36 commits behind main, none of
this session in it), the two live user-facing bugs with fixes in flight (#688
the caret reveal, #689 the page readout), the four items blocked on the owner
(`workflow` token scope, the Mac GitHub SSH key, #681, #687), and the landmines
worth inheriting -- one worktree per test run, `cargo test --no-run` first,
`--release` not debug (#667), apply a diff rather than copying files when
splitting a PR, and retarget stacked children before merging a parent.

No live Commander successor exists: Jaysen is dead per the owner, Daniel has
been silent since 2026-09-15T13:01Z, and every Remote Control peer is offline.
The seat is published as OPEN.

Implementation-Agent: Claude Opus 5 (orchestrator-astra, linux-primary)
Commit-Executor: Claude Opus 5 via Claude Code

Co-authored-by: Claude Opus 5 <[email protected]>
@GoKubar
GoKubar merged commit a7a90fc into main Sep 16, 2026
18 of 21 checks passed
d-q222 added a commit that referenced this pull request Sep 16, 2026
…ers (unbreaks main)

What changed:
#689 (a7a90fc) added testPageReadoutCountsTheDisplayListNotTheElidedV1Pages
to PreviewV2ParityTests, but `model()` and `load(_:_:)` are private members of
PreviewV2ShellTests. The FlashTeXMacTests target therefore does not compile on
main, so the whole apps/mac suite is red:

  PreviewV2Tests.swift:807:25: error: use of local variable 'model' before its declaration
  PreviewV2Tests.swift:809:9: error: static member 'load' cannot be used on instance of type 'PreviewV2ParityTests'
  PreviewV2Tests.swift:809:13: error: argument passed to call that takes no arguments
  error: Build failed

The test is moved verbatim into PreviewV2ShellTests, which already has both
helpers and `Self.fixtures`, and is already @mainactor at class level. No
assertion changed. This merge cannot be validated at all without it.

What was run:
- apps/mac: swift build --build-tests -> Build complete! (12.09 sec)
- apps/mac: swift test --filter PreviewV2
    Test Suite 'PreviewV2ShellTests' passed
      Executed 9 tests, with 0 failures (0 unexpected) in 0.214 seconds
- Baseline check that the remaining apps/mac failures are main's, not this
  branch's: the same relocation applied to a detached origin/main worktree
  (dbe3cac) gives an identical failure set --
    origin/main:  Executed 52 tests, with 1 test skipped and 86 failures (0 unexpected)
    this branch:  Executed 52 tests, with 1 test skipped and 86 failures (0 unexpected)
  (swift test --filter 'SignatureHelpTests|SnippetTests|EditorChangeEnvironmentTests|EditorFirstFocusTests')

Next step:
the 86 SignatureHelp/Snippet/EditorChangeEnvironment/EditorFirstFocus failures
and the Completion-family abort are pre-existing on main and belong to another
lane; they are not touched here.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
ItsAkilesh pushed a commit to ItsAkilesh/flashtex that referenced this pull request Sep 18, 2026
…lash-tex#695)

What changed:
PR flash-tex#689 added testPageReadoutCountsTheDisplayListNotTheElidedV1Pages at
the end of PreviewV2ParityTests instead of PreviewV2ShellTests, where the
model()/load() helpers it calls actually live. PreviewV2ParityTests has
neither helper, so the test target failed to compile on main
(dbe3cac), taking the whole `mac app (swift build + test)` CI job down
with it. This moves the test, unchanged, into PreviewV2ShellTests (which
is already @mainactor at the class level, so the redundant per-method
@mainactor is dropped) and does nothing else.

What was run:
- `cd apps/mac && swift build` — Build complete!
- Before (origin/main content, reproduced): `swift test` failed to
  compile with the same two errors as flash-tex#695:
  PreviewV2Tests.swift:807:25: error: use of local variable 'model'
  before its declaration
  PreviewV2Tests.swift:809:9: error: static member 'load' cannot be
  used on instance of type 'PreviewV2ParityTests'
- After (this fix): `swift test --filter 'PreviewV2'` — Executed 29
  tests, with 0 failures (0 unexpected), including
  testPageReadoutCountsTheDisplayListNotTheElidedV1Pages passing under
  PreviewV2ShellTests.

Next step: none; ready for review.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
ItsAkilesh pushed a commit to ItsAkilesh/flashtex that referenced this pull request Sep 18, 2026
…ced a test)

testPageReadoutCountsTheDisplayListNotTheElidedV1Pages landed in
PreviewV2ParityTests, which has no model()/load() helpers -- so
'let model = try model()' referenced the just-declared local before its
own initializer ran, and the unqualified load(model, ...) call resolved
to NSObject's inherited +load instead. Both are compile errors, so the
whole FlashTeXMacTests target failed to build and 'swift test' never ran
a single test; SwiftPM's generic 'error: fatalError' summary line for
that build failure looked like a runtime crash.

Moved the test to PreviewV2ShellTests, which already has the ShellModel
model()/load() helpers it actually needs. 9/9 in PreviewV2ShellTests and
4/4 in PreviewV2ParityTests pass; 'swift build --build-tests' is clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant