Skip to content

feat(editor): seed cap, IME deferral, localized New buttons (RFC 0019 clauses 2+7) - #64

Merged
willwade merged 4 commits into
mainfrom
feat/editor-followups
Sep 12, 2026
Merged

willwade merged 4 commits into
mainfrom
feat/editor-followups

Conversation

@willwade

@willwade willwade commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

The RFC 0019 follow-ups from #57 — pure Windows code, no engine changes.

Seed cap (clause 7)

Over-long pane or target text (the 500k-char document case) now seeds only a trailing 100k-UTF-16-unit window, caret moving with it — a full model rebuild per keystroke stops being acceptable at extreme sizes. Policy extracted as a pure function (EditorSeedPolicy) with 5 unit tests (under-cap passthrough, window + caret adjustment, caret-in-dropped-head clamps, out-of-range clamps). Applied on both seed paths: pane edits and target-field reads.

IME composition deferral (clause 2)

Mid-composition TextChanged events carry the evolving composition string; seeding each intermediate state is wasted rebuilds. An Imm32 probe (ImmGetContext + GCS_COMPSTR) defers the seed while composition is active; a 250 ms recheck timer completes it on commit. On IMMs where the probe can't see composition, degrades to today's immediate seeding — always correct, merely noisier. Real-IME verification (CJK) still pending — #57 stays open for that sign-off; the unit-testable logic (cap) is fully covered.

Localized New buttons

Label from the catalogue's existing new key; tooltip from new_session_tooltip (dasher-shared-resources#3). Wired via code-behind Loc.Tr; AXAML keeps English defaults per the repo's tooltip convention until the broader tooltip-i18n pass.

97/97 tests green. Submodule bump + resx regen lands as a second commit once dasher-shared-resources#3 merges.

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the prior seed-boundary, duplicate-seeding, cap-aware comparison, and localization findings are resolved, and no new actionable defect is established.

Findings

  1. P2 Tooltip Translation Is Missing ▶

Summary

  • Caps external target-context seeds to a surrogate-safe trailing 100,000-UTF-16-unit window and adjusts the caret accordingly.
  • Defers pane reseeding while an IME composition is active, then seeds committed text once.
  • Localizes the New-session label and tooltip across the generated resource family.
  • Updates the DasherCore and shared-resources submodule pins and adds focused seed-policy tests.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Edit[Pane TextChanged] --> Probe{IME composition active?}
    Probe -->|Yes| Defer[Mark seed pending]
    Defer --> Timer[250 ms recheck]
    Timer --> Probe
    Probe -->|No| PaneSeed[Seed full pane text once]
    Target[External target context] --> Clamp[Clamp to trailing 100k UTF-16 units]
    Clamp --> Boundary[Align surrogate boundary and caret]
    Boundary --> Compare{Matches engine shadow?}
    Compare -->|Yes| Reanchor[Update offset only]
    Compare -->|No| TargetSeed[Seed bounded target context]
Loading

Reviews (4) · Last reviewed commit: "chore: pin DasherCore to v0.2.24"

… clauses 2+7)

#57 follow-ups from RFC 0019:

- Long-document seed cap (clause 7): over-long pane or target text seeds
  only a trailing 100k-UTF-16-unit window, caret moving with it - a full
  rebuild per keystroke stops being acceptable at extreme sizes. Policy
  extracted as a pure function (EditorSeedPolicy) with 5 unit tests;
  applied on BOTH seed paths (pane edits and target-field reads).

- IME composition deferral (clause 2): mid-composition TextChanged events
  carry the evolving composition string; seeding each intermediate state
  is wasted rebuilds. An Imm32 probe defers the seed until composition
  ends (recheck timer completes it); on IMMs where the probe cannot see
  composition this degrades to today's immediate seeding - always
  correct, merely noisier. Real-IME verification (CJK) still needed:
  #57 stays open for that sign-off.

- New buttons localized: label from the shared catalogue's existing
  'new' key, tooltip from new_session_tooltip (dasher-shared-resources#3);
  wired via code-behind Loc.Tr (AXAML keeps English defaults as the
  repo's tooltip convention does).

Signed-off-by: will wade <willwade@gmail.com>
Comment thread src/Dasher.Windows/Services/EditorSeedPolicy.cs Outdated
Comment thread src/Dasher.Windows/Views/MainWindow.axaml.cs
Comment thread src/Dasher.Windows/Views/MainWindow.axaml.cs
Comment on lines +623 to +624
// catalogue (new + new_session_tooltip; dasher-shared-resources#3).
var newTip = Loc.Tr("new_session_tooltip", "New session (clear text and context)");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tooltip Translation Is Missing

new_session_tooltip is absent from the committed neutral and culture-specific resource files. Loc.Tr therefore always uses the English fallback, leaving this tooltip untranslated in every non-English locale. Please add the catalogue entry and regenerate the resource family as part of this change.

Knowledge Base Used:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected at this commit: the catalogue entry is dasher-shared-resources#3 (open); once merged, the follow-up commit here bumps the submodule and regenerates the resx, and the tooltip resolves via Loc.Tr like the training-panel batch did (#54 -> #55).

… pane capping, IME dedupe

Greptile round on #64 (2xP2 + P1 + P2):

- Surrogate split (P2): the fixed UTF-16 cutoff could land on the LOW half
  of a supplementary character, seeding an unpaired surrogate through the
  UTF-8 bridge. The window start slides one unit forward when it lands on
  a low surrogate; boundary test added with an emoji straddling the cutoff.

- Cap defeats shadow comparison (P1) - and behind it, a worse one: for an
  over-cap TARGET the engine buffer holds the clamped text while the
  unchanged-text check compared the FULL document - never equal, so every
  caret move re-seeded (the #58 reset loop reborn for huge documents).
  The compare now uses the same clamped text. While fixing it, the PANE
  path lost its cap entirely: the pane IS the document and the engine
  buffer mirrors back through the VM binding, so a capped pane seed would
  have truncated the user's document on the next engine-origin push
  (buffer-as-document invariant; the RFC clause-7 cap is target-field
  only, where the target's app owns the full text).

- Double seed on IME commit (P2): the commit event (composition ended)
  seeded immediately but left the deferred flag armed - the 250 ms timer
  re-seeded the same text. The immediate seed now supersedes the pending
  one.

- Tooltip resx (P2): expected - the resx regen and submodule bump land as
  the follow-up commit once dasher-shared-resources#3 merges.

Signed-off-by: will wade <willwade@gmail.com>
Comment thread src/Dasher.Windows/Views/MainWindow.axaml.cs
…tip)

Dasher-shared-resources#3 merged - the New buttons' tooltip now resolves from the locale files (resolves the review P2 on the untranslated tooltip). Label reuses the existing 'new' key from the GTK batch.

Signed-off-by: will wade <willwade@gmail.com>
Same pin as the hotfix branch - CAPI refactor complete and tested.

Signed-off-by: will wade <willwade@gmail.com>
@willwade
willwade merged commit 053892f into main Sep 12, 2026
3 checks passed
@willwade
willwade deleted the feat/editor-followups branch September 12, 2026 19:38
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