User-defined segment boundaries#126
Draft
alex-rawlings-yyc wants to merge 15 commits into
Draft
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
cfa0a17 to
69f8147
Compare
f43875e to
c75337e
Compare
c75337e to
aef704c
Compare
A chapter's pre-verse-1 superscription is a real, focusable verse-0 segment, but `liveScrRef` held a stickiness guard that swallowed any same-chapter `verseNum: 0` reference naming the verse already shown. That guard was added (b9dec18, "fix verse-0 echo nav") before verse 0 was a parsed verse, to absorb the host's spurious post-verse-nav chapter echo. It could not distinguish that echo from a genuine external `<` (previous-verse) from verse 1 — both are same-chapter, verse 0, and markerless on the global selector path — so it also ate the intentional `<`, leaving the extension stuck on verse 1 instead of moving to the superscription. Verified in a live session (probe logging liveScrRef/rawScrRef) that the host no longer emits the spurious echo: exactly one delivery per navigation, never an unsolicited trailing verse 0. With the echo gone the guard defended against nothing, so remove it. Verse 0 now passes through verbatim; the host's `<` from verse 1 lands on the chapter's superscription (the loader resolves verse 0 to the superscription segment, else to verse 1). The internal-nav marker machinery is retained — it still classifies internal/external navigations for the recenter fade. Only its former role inside the verse-0 guard is gone. Tests: collapse the two sticky-behavior tests into one pass-through regression test; flip the mid-reveal fade test to expect the curtain to re-engage for a verse-0 navigation arriving during fade-in (verse 0 is now an ordinary mid-reveal move). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
201f874 to
9fec2f4
Compare
…o I can work on this elsewhere)
9fec2f4 to
54240fc
Compare
Verse-0 superscriptions are ordinary segments now: addBoundaryBefore, removeBoundaryAt, and moveBoundary no longer refuse edits that touch a superscription's interior or its bordering boundaries. The UI-side wall comes out separately. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The resegmented book is derived from the draft's ref-held segmentation, and the auto-save's setDirty(true) bails out of the re-render once the draft is already dirty — so clicking merge/split updated the stored delta without updating the view. useDraftProject now bumps a dedicated segmentationVersion on every boundary edit, and the loader keys the resegment memo on it so the new boundaries take effect in place without remounting the editor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
After a merge/split a segment no longer corresponds 1:1 to a verse, so the old verse-number header could repeat or skip. Each segment now shows a per-chapter sequential segment number (starting at 0 for a verse-0 superscription) with the verse range it contains beside it, e.g. "2 (2–3)". The labels are built once over the whole book by a new pure segment-labels util so the numbering doesn't depend on which window slice is mounted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
phrasesStraddlingBoundary finds every phrase a proposed segment boundary would cut (including the gap between fragments of a discontiguous phrase) and pairs each with the split point that severs it cleanly at the boundary. usePhraseLinkByIdGetter exposes a stable, non-subscribing read of the phrase-link map for event-time callers. Both are consumed by the boundary-control rework that follows: one predicate shared by the force-break dispatch and the split-control suppression so the two can't drift apart. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Segment-boundary editing is no longer a separate mode toggled from the view options. Instead: - The between-group slots always carry a boundary control alongside the link icon: a split control inside a segment (hover-revealed with the slot) and a horizontal-fold merge control at a segment boundary in the continuous strip. - The segment list gets an always-visible full-width merge button in the gap between adjacent rows. - Hovering any of these previews the operation: the affected token groups render a new strong phrase-candidate outline (distinct from and outranking hover/focus), and hovered row merges outline and tint the two rows they would join. - The not-mid-phrase rule becomes a UI-only guard sharing one predicate (phrasesStraddlingBoundary) with the dispatch: the split control hides and the cross-segment pull disables at boundaries that would cut a phrase, while the wrapped segmentation dispatch force-breaks straddled phrases for callers that cannot see them. - The verse-0 hard wall comes out of the UI to match the model: superscriptions merge and split like any other segment. Merged-away default verse boundaries render a faint former-boundary tick (formerBoundaryRefs replaces verseZeroSegmentIds in the segmentation context) so a split can restore the original segmentation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A merge/split hands the views a fresh book object while every token ref survives, and the old code treated that like a book swap: - Interlinearizer reseeded focusedTokenRef to the active verse's first word (or the book's first phrase when a merge removed the active verse's segment start). It now keeps a still-resolving focus and reseeds only when the token no longer exists in the new book. - useSegmentWindow faded and recentered on the new segments identity, snapping away from the point just clicked. A segments change at an unchanged anchor verse now redraws in place with no fade. - ContinuousView's committed active segment kept naming a segment that no longer existed, deactivating every link button until the next navigation; a reconcile effect commits the new id when a segmentation edit changes the focused token's segment without moving focus. The instant-jump reveal also re-centers each frame through the link-slot transition so async arc/morpheme layout can't drift the strip off-center. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rewrites the segment-boundaries section for the no-edit-mode UX: always-available controls (item 5), superscriptions as ordinary segments (item 6, replacing the hard-wall interim), and silent force-breaking of straddled phrases (new item 7). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change is
Summary by CodeRabbit
New Features
Bug Fixes