feat(editor): seed cap, IME deferral, localized New buttons (RFC 0019 clauses 2+7) - #64
Merged
Merged
Conversation
… 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 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)"); |
There was a problem hiding this comment.
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:
Contributor
Author
… 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>
…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>
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.
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
TextChangedevents 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
newkey; tooltip fromnew_session_tooltip(dasher-shared-resources#3). Wired via code-behindLoc.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.
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
Summary
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]Reviews (4) · Last reviewed commit: "chore: pin DasherCore to v0.2.24"