Repository navigation
LT-22671: Add a writing-system selector to the Go-family dialogs - #1217
Conversation
NUnit Tests 1 files ± 0 1 suites ±0 15m 0s ⏱️ + 1m 33s Results for commit 424dec1. ± Comparison against base commit 463776f. This pull request removes 1 and adds 31 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1217 +/- ##
==========================================
+ Coverage 40.40% 40.42% +0.01%
==========================================
Files 1551 1552 +1
Lines 355664 355801 +137
Branches 41488 41523 +35
==========================================
+ Hits 143715 143840 +125
+ Misses 182650 182646 -4
- Partials 29299 29315 +16
🚀 New features to boost your workflow:
|
ad464aa to
659cb07
Compare
|
Possible problem: the closed Writing System picker may show one writing system while the dialog searches in another. I found this by reading the code and haven't run it, so I may be missing something. What I think happens (Go to Entry, default vernacular selected):
Why I think so: "Keep a dismissed dropdown on its committed choice" fixes this for the open dropdown, but I don't think it covers the closed one. The PR description's reason for not refocusing the search box after a switch ("arrow keys on a collapsed picker change the selection") sounds like arrow keys are meant to switch the writing system. If I'm reading the code right, they currently only change the label. If it's real, two possible fixes:
Either way, a test that presses Down on the closed picker and checks that |
|
Thanks Mark, you read it right. The tests below reproduced it before the fix. Fixed in bb8e569 with your first option, which is also how the WinForms It's the shared control, so Insert Entry's Morph Type and Complex Form Type dropdowns get the same fix. That gap was already on New tests:
The three dialog and control tests failed before the fix. |
bb8e569 to
7597184
Compare
Every entry-search dialog (Go to Entry, Merge Entry, Add Allomorph, Link Allomorph, Link MSA, Link Entry or Sense) now shows a "Writing System:" picker under the search box, as the WinForms BaseGoDlg does. It lists each current analysis and vernacular writing system once, sorted by name, with the default vernacular one selected. Picking a writing system re-runs the search in it: an analysis writing system matches sense glosses, a vernacular one matches citation, lexeme and alternate forms. The search box takes the chosen writing system's font and direction, resetting them when the choice changes, and its keyboard switches when the box gains focus. The dialog stays free of LCModel: the search-box spec carries the options and a selection callback, and each launcher shares one SearchWritingSystem between that callback and its search, which reads it on every query. Closes GAP-WS-SELECTOR in the control exemplar map and documents the design in dialog-conversion.md 2d. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add Allomorph now opens with the writing system of the form being added selected, as the WinForms dialog does, so a form typed in a second vernacular writing system is found straight away. A writing system that is not current falls back to the default vernacular one. Result rows no longer show "???" for an entry with no form in the default vernacular writing system: the headword falls back to the first current vernacular writing system with a form, then the analysis ones. The new selector made such entries reachable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 2d note said the default vernacular writing system is always selected. It now describes the starting writing system the launcher supplies, Add Allomorph starting on the form's writing system, and the headword fallback across writing systems. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FwOptionChooser's dropdown mode copied every highlight move into its collapsed label and SelectedOption, including arrow keys and filtering while the flyout was open. Escape or a click-away then closed it without committing, so the label showed a value nobody chose: in the Go-family dialogs, the Writing System picker could read English while the search still used Spanish. While the flyout is open, a selection move is now only a highlight. Closing without a pick puts the highlight back on the committed row, so the label and SelectedOption keep showing it. External moves while closed still update the label, which Insert Entry's derive-on-type reselection relies on. Insert Entry's Morph Type and Complex Form Type dropdowns get the same fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Up/Down on a closed FwOptionChooser dropdown moved its label without raising OptionCommitted, so the label could disagree with the dialog: the Go-family Writing System picker could read "English" while the search stayed on the vernacular, and Insert Entry's Morph Type could read "prefix" while the entry was still created as a stem. A closed dropdown now commits an arrow move at once, as a WinForms drop-down list does. While open, a move is still only a highlight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7597184 to
424dec1
Compare
Start here:
Src/LexText/LexTextControls/Avalonia/EntryGoLauncherShared.cs--SearchWritingSystem,GetSearchFieldsandBuildSearchFieldSpecare the mechanism; the rest plumbs into them.Every Avalonia Go-family dialog (Go to Entry, Merge Entry, Add Allomorph, Link Allomorph, Link MSA, Link Entry or Sense) gets the
BaseGoDlg"Writing System:" selector. An analysis writing system searches sense glosses; a vernacular one searches citation, lexeme and alternate forms. The search box follows the choice's font, direction and keyboard.Headless captures (Avalonia.Headless, test data): Spanish selected; Arabic selected, the search box flips right-to-left.
Is this only a dropdown? No: the legacy selector changes which fields are searched. The dialog stays LCModel-free (options and a
WritingSystemChangedcallback onEntryGoSearchFieldSpec); each launcher shares oneSearchWritingSystembetween that callback and its search delegate, which reads it on every query. The question worth your time is whether that hand-off is ordered correctly.Where to look
EntryGoDialogViewModel.OnSelectedWritingSystemChanged: the callback must run beforeRunSearch. Pinned bySharedSearch_SelectionChangedAfterBuild_NextSearchUsesNewWsandGoFamilyBuildInputs_SelectorDrivesTheirSearch(all six dialogs).GetSearchFields: analysis to glosses, vernacular to forms, both to both.EntryGoDialogView.ApplySearchTypography: clears what the new writing system leaves unset, so right-to-left reverts.HeadwordTextfalls back across writing systems instead of showing "???"; Insert Entry and Merge use it too.FwOptionChooserdropdown mode, shared with Insert Entry's Morph Type and Complex Form Type: closed, Up/Down commit at once, as a WinForms drop-down list does; open, a move is only a highlight and dismissing keeps the committed choice. Pinned byDropdown_ClosedArrowKeys_CommitTheNextOptionandDropdown_HighlightThenEscape_KeepsTheCommittedSelection.Not here
main:***for an empty gloss (LT-22883) and the headword font per value (LT-22884).Verification:
test.ps1FwAvaloniaTests 942 passed, 1 skipped; FwAvaloniaDialogsTests 300/300; LexTextControlsTests 379 passed, 3 pre-existing skips; comment and token hygiene clean. Author ran Go to Entry, Merge, Link Entry or Sense and Add Allomorph under the new UI, and re-checked Add Allomorph after the review fixes; the closed-picker arrow fix is not yet checked by hand. Not run: a fullbuild.ps1. Based on 936ae91;mainhas moved on, no overlapping files.Next: check the hand-off ordering and approve, or name a deliberate difference to change.
Reading this a year from now -- start here
This PR closes GAP-WS-SELECTOR from the control exemplar map. The durable design note is
dialog-conversion.mdsection 2d (in the tree); the exemplar map row and a lessons-ledger entry were added alongside it. Nothing was deleted from the branch: its only markdown changes are those three skill references. The reasoning below is what the code and docs do not say.The layer cake -- from a pick to a search
EntryGoDialogViewbuilds a dropdownFwOptionChooserintoPART_WritingSystemHostfromEntryGoDialogViewModel.WritingSystems. Committing an option setsSelectedWritingSystem.EntryGoDialogViewModel.OnSelectedWritingSystemChangedinvokesEntryGoSearchFieldSpec.WritingSystemChanged(id), raisesSearchTypography, then re-runs the search.EntryGoLauncherShared.BuildSearchFieldSpec) points the sharedSearchWritingSystem.Handleat the chosen writing system.BuildEntrySearch/BuildEntryOrSenseSearch) reads the handle and asksGetSearchFieldsfor fields: vernacular gives citation, lexeme and alternate forms; analysis gives sense glosses.EntryGoSearchEngineruns those fields; rows take their headword fromHeadwordText.SearchTypography, clearing whatever the new writing system leaves unset.Decisions, and why
Func<string, ...>to carry the writing system would have touchedEntryGoDialogInput, the ViewModel and every launcher's search contract. The holder confines the change to the launcher layer. Cost: the ViewModel must report the change before it searches.FwOptionChooser, not aComboBox. The exemplar map's dialog rule forbids ad-hoc ComboBoxes.EntryGoDlg.GetFieldsalso searches definitions when the Definitions column is visible; it is hidden by default and the Avalonia list has no column chooser, so the default is what ships.BaseGoDlg.SetDlgInfo(..., tssform)). Go to Entry, Merge and Link Entry or Sense start on the default vernacular one in WinForms too. A starting writing system that is not current falls back to the default vernacular one, so the selection and the search cannot disagree.Sorted = true) is, not grouped by kind.Paths not taken
fwFieldHost, to avoid the doubled frame: the view harness fails anyPART_*Hostwith a zero border, and all 45 view tests failed. The framed host is the convention.BaseGoDlgdoes: arrow keys on a collapsed picker change the selection, so stealing focus breaks browsing. The keyboard switch happens when the user returns to the box.Surprising findings
HeadWordreads the default vernacular writing system only; the WinForms browser column usesbest vernoranal. The bug predates this branch but was unreachable until the selector let a search find such entries.Deferred, and what would unblock it
EntryGoResultColumnrather than per-column.GlossesText,SenseGlossandLexemeFormTextuse LCM's best-alternative properties, which return***when nothing is stored, andHeadwordText's last fallback returns???for an entry with no form at all. Already onmain; found while manually testing this PR.WordformGoDlg(vernacular only) andReversalEntryGoDlg(the index's writing system only) narrow the list. Neither is in the Avalonia family yet; porting one needs a way for the launcher to pass a subset toBuildSearchFieldSpec.Evidence
New tests:
EntryGoDialogLauncherTests(real cache):SharedSearch_AnalysisWsSelected_FindsEntryByGloss,SharedSearch_VernacularWsSelected_DoesNotMatchGlosses,SharedSearch_SecondVernacularWsSelected_FindsEntryByFormInThatWs,SharedSearch_SelectionChangedAfterBuild_NextSearchUsesNewWs,SharedEntryOrSenseSearch_AnalysisWsSelected_SenseModeFindsSenseByGloss,BuildSearchFieldSpec_*(options, typography, callback, null argument),GoFamilyBuildInputs_SelectorDrivesTheirSearch,AddAllomorph_BuildInput_OpensOnTheFormsWritingSystem,AddAllomorph_BuildInput_FormInANonCurrentWs_OpensOnTheDefaultVernacular,HeadwordText_*.EntryGoDialogTests(ViewModel and realized headless view):WritingSystemSelector_*-- initial selection, unknown-id fallback, change reports and re-searches, typography change, cleared selection, labelled picker, right-to-left and back, reset to defaults, hidden row.Manual check, new UI:
$env:FW_AVALONIA = '1'and startOutput\Debug\FieldWorks.exe; choose the new UI in Tools > Options > General.Preflight review details
Code Review Summary
Branch: LT-22671-go-dialog-ws-selector
Base: main (merge base 380cc90; origin/main is 8 commits ahead, none touching these files)
Date: 2026-10-29
Review model: Claude Opus 5.5
Files changed: 19 (3 commits: feature, in-review fixes, doc alignment)
Overview
LT-22671 adds the WinForms
BaseGoDlgwriting-system selector to every Avaloniaentry-search ("Go") dialog: Go to Entry, Merge Entry, Add Allomorph, Link
Allomorph, Link MSA, and Link Entry or Sense. A "Writing System:" row under the
search box offers every current analysis and vernacular writing system. Picking
one re-runs the search in it: analysis searches sense glosses, vernacular searches
citation, lexeme and alternate forms. The search box takes the chosen writing
system's font and direction and switches keyboard on focus.
The dialog layer stays LCModel-free:
EntryGoSearchFieldSpeccarries the optionsand a
WritingSystemChangedcallback; each launcher shares oneEntryGoLauncherShared.SearchWritingSystembetween that callback and its searchdelegate, which reads it on every query. Analysis found one parity gap in Add
Allomorph, and manual testing found a "???" headword exposed by the new selector;
both were fixed during review.
Contract/API Changes
FwAvaloniaDialogs(public, additive): newEntryGoWritingSystemOption;EntryGoSearchFieldSpec.WritingSystems,SelectedWritingSystemId,WritingSystemChanged;EntryGoDialogViewModel.WritingSystems,HasWritingSystemSelector,WritingSystemLabel,SelectedWritingSystem,SearchTypography.FwAvaloniaDialogs.EntryGoWritingSystemLabel("Writing System:",same seed text as
LexTextControls.ks_WritingSystem_).BuildVernacularSearchFieldSpec(cache)replaced byBuildSearchFieldSpec(cache, searchWs);GetSearchFieldstakes the cache;BuildEntrySearch/BuildEntryOrSenseSearchand the six launchers'BuildSearchgain an optionalSearchWritingSystem. All callers updated.EntryGoLauncherShared.HeadwordTextnow falls back across currentwriting systems; it also feeds Insert Entry's matching list and Merge's
confirmation text.
Findings
Critical - Must address before merge
None.
Important - Should address before merge
the form's (fixed during review:
LcmAddAllomorphDialogLauncher.BuildInputseeds the shared writing system from
tssForm;BuildSearchFieldSpecreplaces anon-current one with the default vernacular. Tests
AddAllomorph_BuildInput_OpensOnTheFormsWritingSystem,AddAllomorph_BuildInput_FormInANonCurrentWs_OpensOnTheDefaultVernacular.)(found in manual testing; fixed during review:
HeadwordTexttries each currentvernacular writing system, default first, then analysis, matching the WinForms
column's
best vernoranal. TestsHeadwordText_NoDefaultVernacularForm_UsesAnotherVernacularForm,HeadwordText_DefaultVernacularForm_IsPreferred.)Minor - Consider
headword comes from another writing system (author: leave for a follow-up; filed as LT-22884)
Required Validation / Evidence
Run:
./test.ps1 -TestProject Src/LexText/LexTextControls/LexTextControlsTests -CommentHygiene -TokenHygieneafter the in-review fixes: 379 passed, 3 skipped(pre-existing: two LIFT import tests,
GlossesBeforeWords; plus the explicitscreenshot harness), 0 failed.
./test.ps1 -TestProject Src/Common/FwAvaloniaDialogs/FwAvaloniaDialogsTests -CommentHygiene -TokenHygiene: 297/297 (the in-review fixes do not touch thisproject).
Build/Agent/comment-hygiene.ps1andtoken-hygiene.ps1: clean.Manual (author-confirmed): Go to Entry, Merge Entry, and Link Entry or Sense (via
Reversal Indexes > Senses) under the new UI with
FW_AVALONIA=1; the AddAllomorph repro in the Interlinear sandbox, and its re-check after the in-review
fixes (Spanish preselected, "chucho" listed, no "???").
Still needed:
./build.ps1full build was not run by the reviewer;test.ps1built the touchedprojects.
Positive Observations
existing EntryGo tests pass untouched.
selection after build, all six dialogs), ViewModel (selection, fallback, cleared
selection, typography change), and realized headless view (picker, RTL and back,
reset to defaults, hidden row).
FwOptionChooserrather than an ad-hoc ComboBox, per the controlexemplar map.
(
EveryAccessorProperty_ResolvesFromTheNeutralResx).dialog-conversion.md2d, and records the scope lesson inlessons-learned.md.Interview Notes
(the harness requires a framed
PART_*Host, and the dropdown draws its own);focus stays on the picker after a switch (the WinForms dialog refocused the
search box, which would break arrow-key browsing of the collapsed picker);
alternate forms are always searched for a vernacular writing system (the
WinForms dialog searched them only when the Allomorphs column was visible).
SearchWritingSystemconnects thepicker's selection callback to the search delegate, and why the ViewModel must
invoke
WritingSystemChangedbefore it re-runs the search. Author answered"not sure".
In-Review Quality Check
The two Important fixes are the second commit. After them the full
LexTextControlsTests run passed with clean comment and token hygiene, and no
comment lines were re-wrapped. A third commit aligns
dialog-conversion.md2dwith the fixes (doc only).
Suggested Review Focus
EntryGoDialogViewModel.OnSelectedWritingSystemChanged: thecallback updates the shared
SearchWritingSystembeforeRunSearchreads it(the area the author is unsure of).
EntryGoLauncherShared.GetSearchFields: analysis to glosses, vernacular toforms, both to both, neither to forms.
EntryGoDialogView.ApplySearchTypography: clears values the new writingsystem leaves unset.
HeadwordTextfallback and its effect on Insert Entry and Merge text.🤖 Generated with Claude Code
This change is