Skip to content

LT-22672 Allomorphs - Environments inline editing - #1152

Merged
thejambi merged 23 commits into
mainfrom
LT-22672-environments-inline-editing
Sep 25, 2026
Merged

thejambi merged 23 commits into
mainfrom
LT-22672-environments-inline-editing

Conversation

@thejambi

@thejambi thejambi commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

An environment already on an allomorph can now be edited in place: click it,
type, tab away. A new one can be typed at the end of the row without opening the
chooser. Until now the Avalonia Environments row was a chooser only -- add and
remove, no caret anywhere.

Before reading the diff: editing an environment is not a text edit. Its
identity is its string with literal spaces removed, so /_# to / _ # creates
nothing and moves no reference -- it renames the shared PhEnvironment, and
every other allomorph pointing at it shows the new spelling. Change the stripped
text and the reference re-points instead, creating a target only if the project
hasn't one. Every case follows from that rule, which PhoneEnvReferenceView
has always implemented and never tested. Review this as reference
reconciliation, not as a text box.

Where to look

  • The row is now a WrapPanel, reaching every reference-vector row in the
    view, not only Environments.
  • Right-click on an environment opens a menu at all now. Item resolution
    answered a reference collection with a generic menu whose every command is
    gated to another class, so it built empty -- indistinguishable from a dead
    right-click. Predates these editors; fixed here because this is the row that
    makes it visible.
  • Respacing reaches the whole project. Deliberate parity, pinned by a test
    asserting from a second allomorph.
  • A retype keeps the writing system the environment was stored in. Most
    projects store these in an analysis writing system, so rebuilding the string
    as vernacular would retag a shared object and change its font everywhere.
  • Clearing an item's text removes it, whitespace included, creating nothing.

Deliberately not here

  • The five insert commands and the caret seam they need -- proposed for
    LT-22691, where the menu code already lives. They appear in the item menu and
    are correctly disabled; nothing has to be undone before wiring them.

Verification

Onto main, nothing stacked. Full suite locally: 6,238 run, 6,176 passed, 62
skipped, 0 failed. 34 new tests, each falsified by suppressing the behaviour and
watching only the right ones fail. Verified in the running application,
including the menus and the writing-system case.


Reading this a year from now -- start here

The design notes for this work lived in Docs/migration/working/Allomorphs/,
which is gitignored. They were never merged, by intent. What was worth keeping
from them is below, rewritten rather than pasted.

The single most useful fact, if you are here because something about
environments is behaving oddly: an environment's identity is its text with
literal spaces removed
(RemoveSpaces is s.Replace(" ", null) -- spaces
only, not tabs). Nearly every surprise in this area follows from that.

What editing an environment does, in all five cases

Read from PhoneEnvReferenceView.ConnectToRealCache, its FindPhoneEnv helper
and EnvsBeingRequestedForThisEntry. No test in the tree pinned any of it
before this branch -- PhoneEnvReferenceViewTests contains a single test, and
only the removal row below is even adjacent to it.

Edit Result
/_# to / _ # (stripped text unchanged) Nothing created, reference does not move. The shared PhEnvironment is renamed, so every other allomorph referencing it displays / _ #.
/_# to /_a, already in the project Reference swaps to the existing /_a. The old environment is untouched and stays in the inventory.
/_# to /_zz, not in the project A new PhEnvironment is created in PhonologicalDataOA.EnvironmentsOS and the reference swaps to it.
Two items on one allomorph whose stripped text matches Resolution refuses to let both claim the same environment while an unclaimed match exists; with none free, both land on the first match.
Anything malformed Created and assigned regardless. Constraint checking drives the squiggle only -- nothing is blocked, corrected or discarded.
Cleared to nothing, or to whitespace The item is removed from the allomorph and nothing is created. The PhEnvironment stays in the project, since other allomorphs may still reference it.

The removal row is the one most easily missed when converting: it is not in
ConnectToRealCache at all, but in the helper deciding which lines the commit
even considers. Ours rejected blank text one layer higher up, and had it not,
would have minted an empty environment -- the guard was hiding a second defect.

Two details that shaped the implementation:

  • The write-back is unconditional. Not "if changed": every commit writes the
    typed string onto the resolved environment. The authoring comment gives the
    reason -- "Maybe the ws has changed, so change the real env in database, in
    case" -- so it carries writing-system changes, not only spelling.
  • Resolution prefers what is already on this field, then the whole project,
    skipping anything claimed by an earlier item in the same commit.

Row 1 is the one to be deliberate about: editing an environment's spacing on one
allomorph silently re-spells it everywhere. Decision: replicate it. Diverging
would make the two views disagree about shared data, which is worse than
reproducing a quirk. Recorded here because a user who hits it will report it as
a bug, and the answer should be "matched deliberately" rather than a fresh
investigation. It is very likely the mechanism behind near-identical duplicate
environments seen in the wild.

Decisions, and why

The row stays a reference-vector row; only its item rendering changes. An
earlier attempt replaced it with a bespoke control and lost the chooser; it was
reverted for that reason. The picker, Remove, the item menu, reordering and
per-item validation all already worked and were all wanted.

IReferenceItemCreation became IReferenceTextEditing. It now covers
creating a target from typed text and retyping an existing item, which is the
capability-area naming IStructuredTextEditing already uses. Acquired by
ctx as IReferenceTextEditing rather than widening IDetailEditContext, so
every other row is untouched by it.

Items are addressed by key, not index. PhoneEnv is a reference
collection (card="col"; only infix Position is card="seq"), so an index
means no more than "wherever it sat when the row was composed".
ConnectToRealCache sidesteps this by rebuilding the whole vector on commit;
addressing by key is the same guarantee for a single edit.

The selection highlight paints only a label. An editor shows its own focus,
and painting its background fights its chrome. Editors are tab stops so the
keyboard walks the items; labels stay out of the tab order, as before.

Focusing the typed slot clears the row's current item, so a menu request
raised from the slot carries no item rather than a stale one.

Staging waits for the edit to finish, not per keystroke -- the opposite of
every other text row here. Each stage reconciles against the project, so staging
every keystroke of /_zz would leave environments behind for /, /_ and
/_z.

Resolution prefers an unclaimed match already on the field, which is what
stops retyping one item from stealing the environment another item is using.

Backspace and Delete no longer remove the focused item on a retypable row.
That binding arrived with the reference-vector menus (#1133); on an editor those
keys are text editing, and removal stays on the item menu.

The view holds an external refresh while an editor holds unsubmitted text.
These editors stage when the edit finishes, so between the first keystroke and
that finish nothing else knows about the text and a rebuild would discard it.
Escape clears the editors before cancelling, so a cancelled edit leaves nothing
for the next focus change to stage.

A press reaches the row even when the editor marks it handled. A TextBox
consumes the pointer press to place its caret, so the row saw no press and no
item became current -- which broke the item menu and Ctrl+click together, since
both act on the current item. Pinned for an editor and a read-only item alike.

Two layout defects, and three wrong diagnoses before them

Reported as one symptom -- an environment losing its last character -- which is
why it took so long to separate.

The item editor measured its own text short. A TextBox derives its width
from its content, and that width came out about a character narrower than what
it then drew. FloorWidthToText measures the text with FormattedText, the way
a TextBlock does, and holds the box to at least that. The first measure waits
for the box to be in the visual tree, because font size and family arrive with
the theme, and it repeats on TextChanged so the box keeps up while typing.

The row never wrapped. Found while chasing the first. PhoneEnvReferenceView
puts every item in ONE Views paragraph, which breaks to a new line when it runs
out of width. The row was a horizontal StackPanel, which arranges each child at
its desired width whatever the row's width is, so items continued past the right
edge and were cut there. Measured at a row width of 150, the third item was
arranged out to 169.

Three diagnoses were tried and discarded first, each of which looked sound:

Tried Why it was wrong
Flat editors cost less width, so the row fits again Moved the threshold; removed no limit.
A content-sized TextBox leaves no room for the caret past the last glyph Measured: 21px of presenter space for 17px of text. The presenter already reserves the caret. Widening the padding changed nothing.
The row overflows, so the last item falls off the edge A real defect, and fixed -- but not the reported one, which had room to spare on the row.

What eventually worked was not more analysis: it was forcing an unmissable
change -- an absurd 180px minimum width on every item -- which separated three
possibilities in a single glance (were builds reaching the application at all,
was width the cause, was the text complete). Every earlier round rested on "no
change", which cannot distinguish those. Worth reaching for first, not fourth.

What the tests can and cannot pin

Headless Avalonia shapes text with a stub of uniform advances rather than real
font metrics, so a TextBox's measurement matches its rendering there and the
clipping defect cannot arise in a headless test. The tests therefore pin the
invariants rather than the mechanisms:

  • an item editor is never narrower than its own text;
  • no item is arranged past the row's own width.

Both were confirmed by suppression -- removing the floor fails with a MinWidth
of 0 against a text measuring 20; reverting the panel fails reporting an item
reaching x=169 in a row 150 wide.

The five behaviour cases are tested at the composer/edit-context layer, where
the behaviour actually lives, plus a sixth rejecting a key the field does not
carry and a seventh pinning that the row displays the whole string
representation rather than an abbreviated ShortName.

What this does NOT authorize
  • It does not settle how a reference-vector row should behave when a single item
    is wider than the whole row. It wraps between items, not within one.
  • It does not make every vector row retypable. CanEditReferenceItemText is
    asked per field, and only the environments row answers yes.
  • The unconditional write-back is matched parity, not a considered design for
    new code. Do not cite it as precedent.

This change is Reviewable

Zachary Burnham and others added 12 commits September 22, 2026 12:59
The Environments row could add and remove, never change. Raised by Mark K: an
environment already on the field cannot be edited, and the five insert commands
have no caret to insert at.

This is the domain half. An environment is identified by its text with spaces
stripped, and every case follows from that:

- Text stripping to what the item already names leaves the reference alone and
  writes the new spelling onto the shared PhEnvironment, so every allomorph
  referencing it shows it. That reach is surprising and it is what
  PhoneEnvReferenceView.ConnectToRealCache does; matched deliberately rather
  than softened, so the two views cannot disagree about shared data.
- Text stripping differently re-points the item, creating the target only when
  the project has no match.
- Resolution prefers a match the field already carries that no OTHER item
  claims, which stops retyping one item from stealing another's environment.
- A malformed string is staged and kept verbatim, never corrected.

Addressed by item key, not position: PhoneEnv is a reference COLLECTION, so an
index means only "wherever it sat when the row was composed". ConnectToRealCache
sidesteps this by rebuilding the whole vector; addressing by key is the same
guarantee for a single edit.

IReferenceItemCreation becomes IReferenceTextEditing, since it now covers
creating from typed text AND retyping an existing item -- the capability-area
naming IStructuredTextEditing already uses. Eight references, all in-repo.

Six tests, none trusted until falsified. Dropping the write-back fails the
shared-rename case with the other allomorph still reading "/_#"; ignoring what
other items claim fails the no-stealing case. Nothing in this area had a test
before: PhoneEnvReferenceViewTests covers one unrelated edge case.

Editable items in the view are the next commit; the insert commands need the
caret seam and belong with the menu work in LT-22691.

FwAvaloniaTests 748 passed, xWorksTests filter Avalonia 1648 passed, 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The view half of retyping an environment. A row whose edit context reports it
can reconcile typed text renders its items as text boxes instead of labels, so
an item already on the field can be changed and not only removed and re-added.
Every other vector row is untouched: the capability is asked for per field, and
a row that does not claim it keeps the labels it had.

Staged when an edit FINISHES -- focus leaves, or Enter -- not per keystroke,
which is the opposite of how the text rows work and is deliberate. Each stage
reconciles against the project, so staging every keystroke of "/_zz" would
leave environments behind for "/", "/_" and "/_z". The handler sits on the box,
so it runs before the view's focus-loss autosave commits.

Three knock-on decisions:

- Backspace and Delete no longer remove the focused item on such a row; on an
  editor those keys are text editing. Removal stays on the item menu.
- The selection highlight paints only a label. An editor shows its own focus,
  and painting its background would fight its chrome.
- Editors are tab stops, so the keyboard walks the items; labels stay out of
  the tab order as before.

Five tests, falsified by forcing the row to render labels: the editor test
fails on the missing box and the three staging tests follow. The helper that
finds an editor now asserts rather than returning null, so that failure reads
as "rendered no editor" instead of a NullReferenceException further down.

FwAvaloniaTests 753 passed, xWorksTests filter Avalonia 1648 passed, 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
PhoneEnvReferenceView keeps an always-present empty line at the end of its
view, so a new environment is typed rather than chosen. The Avalonia row had
only the "+" picker. This adds the slot; the picker stays, because it is the
other route and not a worse one.

No new domain work: the slot commits through TryCreateAndAddReferenceItem,
which already exists and is what the picker's create row calls. Committed when
the edit finishes rather than per keystroke, for the same reason retyping is --
each commit reconciles against the project.

It also gives an empty row somewhere to start. Until now an Environments row
with nothing on it offered only the "+" button and a thin separator bar.

The slot names no item, so focusing it clears the row's current one. Without
that, a menu request raised from the slot would carry whichever item was
clicked beforehand and act on that instead -- reproduced by suppressing the
clear, which fails the new test with 'Expected: null, But was: "e1"'.

Its own right-click menu stays inert for now. The host resolves an item menu
through the selected key and returns early without one, so nothing opens. Making
a caret-bearing, item-less request build the insert commands belongs with the
menu work in LT-22691.

Five more tests, falsified by suppressing the clear and by forcing the slot off.

FwAvaloniaTests 758 passed, xWorksTests filter Avalonia 1648 passed, 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The new-item slot borrowed DataTree.PickerMinWidth, which is 180 and sizes a
dropdown's selection panel. Inline among items reading "/_#" it dwarfed them.

Its own token instead, at 70 -- a little wider than the writing-system gutter,
and only the empty size: the slot grows with what is typed.

FwAvaloniaTests 758 passed, 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Each item editor carried the default TextBox border and fill, so it cost more
width than the label it replaced and a row that used to fit started clipping at
its right edge. Every other editor in this view is already flat -- no border, no
background -- and these now match.

The row itself has never wrapped or scrolled: it is a horizontal StackPanel, so
enough items have always overflowed and been clipped. Flat editors put that
threshold back roughly where the labels had it, but they do not raise it.

FwAvaloniaTests 758 passed, 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
FwReferenceVectorField was a horizontal StackPanel, which arranges every
child at its desired width whatever the row's own width is. Once the
items exceeded the value column they carried on past the right edge and
were cut there, mid-item if that is where the width ran out -- reported
as an environment losing its last character.

PhoneEnvReferenceView puts every item in one Views paragraph, which
breaks to a new line at the edge instead. A WrapPanel is the same thing:
only Orientation was ever used, and WrapPanel has it.

The test arranges five items in a row too narrow for them and asserts
that none is arranged past the row's own width. Reverted to StackPanel
it fails, reporting an item reaching x=169 in a row 150 wide.

This reaches every reference-vector row, not only Environments. All of
them could be cut this way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A TextBox derives its width from its content, and that width comes out
about a character narrower than what it then draws, so an environment
lost its last character -- at any row width, focused or not.

FloorWidthToText measures the text with FormattedText, the way a
TextBlock does, and holds the box to at least that. The first measure
waits for the box to be in the visual tree, since font size and family
arrive with the theme, and it repeats on TextChanged so the box keeps up
while typing. The typed slot takes the same floor above its empty width.

Suppressing the floor fails the test, reporting a MinWidth of 0 against
a text that measures 20.

Headless cannot reproduce the defect itself: Avalonia's headless
platform shapes text with a stub of uniform advances, so a TextBox's
measurement matches its rendering there. The test pins the invariant
rather than the mechanism -- an editor is never narrower than its text.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The reason recorded on the comment was that an item costing more width
than the label it replaced would make a row that fitted start clipping.
The row wraps now, so it does not, and the reason was never the whole
one: the editors are flat because every other editor in this view is.

No behaviour changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
PhoneEnvReferenceView removes a blank line rather than keeping it:
EnvsBeingRequestedForThisEntry drops any line whose text trims to
nothing, and the rebuilt vector then goes back without it. Its one
existing test pins the same thing from the other side -- three cached
lines, one with text, one result.

Ours could not do this at all. TrySetReferenceItemText rejected blank
text outright, and had it not, the handler would have fallen through to
find-or-create and minted an empty PhEnvironment for the item to point
at. So the guard was hiding a second defect behind it.

Blank now removes the item and creates nothing. Whitespace alone counts
as blank, matching the Trim. The environment itself stays in the
project, since other allomorphs may still reference it.

Suppressing the removal fails exactly the three cases that cover it and
nothing else.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Five rules from converting the Environments row, and the evidence they
came from. Two are worth naming here: a gesture's handling may live in a
helper that filters what the write-back ever sees, so reading the commit
path alone produces a model that looks complete and is not; and a guard
that rejects an input can conceal what the guarded path would have done
with it, which is how an empty domain object nearly got created.

Status is left as proposed, and human review as pending, since the area
README reserves that judgement for a reviewer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
main added TryResetReferenceOrder to IDetailEditContext while this branch
was out. FakeTextEditing implements that interface, so the merge does not
compile -- and a local build on the un-merged branch could not see it,
since the member did not exist there. CI builds the merge, and failed at
the build step with every test skipped.

Returns false, as InMemoryDetailEditContext and the other minimal fakes
do. Nothing here exercises the order reset.

Full suite on the merged branch: 6227 run, 6165 passed, 62 skipped, none
failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

NUnit Tests

    1 files  ± 0      1 suites  ±0   9m 54s ⏱️ - 3m 7s
6 266 tests +49  6 181 ✅ +49  85 💤 ±0  0 ❌ ±0 
6 275 runs  +49  6 190 ✅ +49  85 💤 ±0  0 ❌ ±0 

Results for commit 2538003. ± Comparison against base commit 7f93de0.

♻️ This comment has been updated with latest results.

@codecov-commenter

codecov-commenter commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.19048% with 65 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.99%. Comparing base (7f93de0) to head (2538003).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
Src/xWorks/Avalonia/Composer/DetailComposer.cs 65.90% 21 Missing and 9 partials ⚠️
Src/Common/FwAvalonia/Detail/FwFieldControls.cs 83.95% 20 Missing and 6 partials ⚠️
...rks/Avalonia/Composer/ComposedDetailEditContext.cs 42.85% 1 Missing and 3 partials ⚠️
Src/Common/FwAvalonia/Detail/DataTree.cs 62.50% 1 Missing and 2 partials ⚠️
Src/Common/FwAvalonia/DetailHostControl.cs 50.00% 0 Missing and 1 partial ⚠️
...nia/Hosting/RecordEditView.ReferenceVectorMenus.cs 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1152      +/-   ##
==========================================
+ Coverage   38.91%   38.99%   +0.08%     
==========================================
  Files        1519     1520       +1     
  Lines      352403   352711     +308     
  Branches    40622    40681      +59     
==========================================
+ Hits       137126   137537     +411     
+ Misses     185990   185879     -111     
- Partials    29287    29295       +8     
Files with missing lines Coverage Δ
Src/Common/FwAvalonia/Detail/DetailFocusMemory.cs 71.21% <ø> (ø)
Src/Common/FwAvalonia/Detail/DetailMenuFlyout.cs 95.23% <ø> (ø)
Src/Common/FwAvalonia/FwAvaloniaDensity.cs 96.55% <100.00%> (+0.06%) ⬆️
...AvaloniaTheme/Tokens/DataTree/DataTreeTokens.axaml 100.00% <100.00%> (ø)
Src/xWorks/Avalonia/DetailEditContextHolder.cs 85.07% <ø> (ø)
Src/Common/FwAvalonia/DetailHostControl.cs 69.23% <50.00%> (+1.23%) ⬆️
...nia/Hosting/RecordEditView.ReferenceVectorMenus.cs 55.71% <75.00%> (+0.23%) ⬆️
Src/Common/FwAvalonia/Detail/DataTree.cs 95.88% <62.50%> (-0.42%) ⬇️
...rks/Avalonia/Composer/ComposedDetailEditContext.cs 54.44% <42.85%> (-0.98%) ⬇️
Src/Common/FwAvalonia/Detail/FwFieldControls.cs 83.45% <83.95%> (-0.23%) ⬇️
... and 1 more

... and 16 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Zachary Burnham and others added 3 commits September 23, 2026 12:25
The comment standard bans internal doc pointers: nothing in the tree
resolves "14.2", and it points at nothing once that document is
renumbered or moved. The sentence after it already gives the reason in
the code's own terms, so only the pointer goes.

This is the one such reference these changes introduced. Others predate
them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The comment standard bans internal doc pointers: nothing in the tree
resolves "14.2" or "12.1", and they name nothing once that document is
renumbered. Each comment now states its point in the code's own terms.

Thirty-three across ten files. Most carried a second violation in the
same sentence -- the word "legacy", banned for the same reason -- so
those went too; where a name was genuinely needed the class is named
instead. Four of those were added by this branch and had passed the
hygiene gate, which does not check that rule.

Also unpicks five comments the hygiene auto-fixer had re-wrapped into a
stranded single word.

Comments only. Full suite 6227 run, 6164 passed, 62 skipped; the one
failure is a Windows clipboard API error in an untouched drag-and-drop
test, which passed on this same branch an hour earlier.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The record and its index row are about how the conversion was done, not
what it does, and they sit in a directory this branch otherwise does not
touch. They land separately so this PR stays a code change.

Reverts the file addition only; nothing else on the branch referenced it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@thejambi
thejambi marked this pull request as ready for review September 23, 2026 19:39
Comment on lines +1720 to +1721
target.StringRepresentation =
TsStringUtils.MakeString(text, _cache.DefaultVernWs);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was switching the writing system here intended?

MakeString(text, _cache.DefaultVernWs) saves every retyped environment as a single run in the default vernacular. PhoneEnvReferenceView loads each item with the environment's stored string, so the typed text keeps that string's writing system, and the write-back leaves it unchanged. The "Maybe the ws has changed" comment covers a user deliberately switching writing systems while typing; it doesn't reset them.

This comes up in real data. In Sena 3, 27 of the 39 environments that allomorphs use are stored in en: Times New Roman, where seh is Doulos SIL. All 71 in the LT-22280 Quechua project are en. A spacing-only retype in Avalonia retags the shared environment as seh for every allomorph that uses it, and in the dictionary export. The Avalonia row itself shows no change.

If it wasn't intended: build the string in the writing system of the edited item's current environment, taken from its first run, and fall back to DefaultVernWs when it's empty. Possibly add a test using an analysis-writing-system environment; the current fixtures all use DefaultVernWs, so none of them would catch this. If it was meant to normalize environments to vernacular, could the PR description call that out as a deliberate divergence? At the moment it presents this write-back as matching legacy.

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.

@mark-sil this has now been addressed, along with some comment cleanup and other fixes I found. Ready for re-review.

Zachary Burnham and others added 8 commits September 24, 2026 08:55
Rebuilding the string as DefaultVernWs retagged the environment. The
string is shared, so that changed its font for every allomorph using it
and in the dictionary export, while the row that was edited showed
nothing different.

PhoneEnvReferenceView does not do this. It caches each item with the
environment's stored string and assigns that same string back, so a
retype leaves the writing system alone; only the always-empty new line
starts out vernacular. The "Maybe the ws has changed" comment it carries
is about a user deliberately typing in another writing system, not a
reset.

The writing system is read from the edited item's environment before
resolution, since after a re-point that vector position names the target
instead. FindOrCreateEnvironment still mints a new one as vernacular,
matching the empty line it stands in for.

Reported in review with counts from real data: 27 of the 39 environments
allomorphs use in Sena 3 are stored in an analysis writing system, and
all 71 in the LT-22280 project.

No existing fixture could catch this -- every one used DefaultVernWs.
The new test stores an environment in the analysis writing system and
assumes the two differ, so it cannot pass for the wrong reason.
Suppressed, it fails on the writing system alone.

Full suite: 6228 run, 6166 passed, 62 skipped, none failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
These editors stage when the edit finishes, not per keystroke, so
between the first keystroke and that finish the domain knows nothing
about the text. The host treats "busy" as an open session or a pointer
gesture, and neither is true in that window, so an external change
arriving mid-edit recomposed the view and discarded what was typed. The
typed slot had the same hole. Every other text row stages per keystroke,
so this window belongs to these editors alone.

The row now reports text it has not offered to the domain, and the view
counts that as interaction in flight. Finishing the edit raises the
completion the host already re-shows on, which releases the hold.

Busy means unsubmitted rather than different-from-original: a refused
edit is finished, and holding the host open for one would block every
later refresh with nothing left to retry.

Reported in review. Full suite: 6232 run, 6169 passed, 62 skipped; the
one failure is the writing-system-manager test that fails on main too.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Holding refreshes for unsubmitted text broke Escape. The view's own
completion is what discards that text -- the host re-shows and the
editor is rebuilt from stored state -- and deferring it on the same
condition meant Escape cancelled the session, held the re-show, and left
the text in the editor for the next focus change to stage. Escape saved
the edit it was asked to discard.

Two questions had been answered by one predicate. IsInteractionInFlight
is again only about a rebuild reaching a control mid-gesture, and
decides nothing but the completion. HasUnsubmittedText is the separate
one, and only the host's busy check consults it. A completion can no
longer be held on a condition that a pointer release alone would clear.

Escape also clears the editors, which is needed on its own: the refresh
that follows re-checks the same condition, so text left behind would
have held the re-show whichever predicate deferred the completion.

Reported in review. Full suite: 6234 run, 6172 passed, 62 skipped, none
failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Re-pointing an item at an environment the project already has rewrites
that environment with what was typed: its spelling and its writing
system both, for every allomorph referencing it. The existing case-2 test
could not show this -- it types the target's own spelling, so the
rewrite is invisible.

PhoneEnvReferenceView does the same, assigning the edited line's string
to whatever FindPhoneEnv resolved, moved reference or not. Raised in
review as a writing-system question; the spelling travels the same way,
so preserving only the writing system would leave the same surprise
behind more quietly.

Pinned rather than changed. Whether to keep it is a question for the
domain owner, and this makes changing it a deliberate act.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
"WS" and "ctx" are the kind the standard asks to be written out, and
"ctx" named no variable in the code -- the callers use editContext.

Comments only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The summary argued for the test's existence and predicted a bug report,
which is framing for a reviewer rather than a description of behaviour.
It now carries the fact that was standing behind the argument: only
spacing and writing system can differ, because resolution matches on
text with spaces stripped.

Reported in review. Comments only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Right-clicking an environment did nothing at all -- no menu, not even
Remove. An editor marks the pointer press handled to place its caret,
and a handler added the ordinary way does not run for a handled event,
so the press selected no item. The menu request then carried no key, the
host resolved no object, and it built an empty menu. A read-only item
was unaffected, which is why this only appeared once items rendered as
editors.

Registering with handledEventsToo restores it. Bubble alone: both routes
would run the handler twice, and Ctrl+click raises the default jump on
that handler, so it would jump twice.

Ctrl+click went through the same handler and was broken the same way;
this restores it too.

Asserted for an editor AND a read-only item. The defect was those two
diverging, so pinning either alone would leave the gap it fell through.

Reported from manual testing. Full suite: 6237 run, 6175 passed, 62
skipped, none failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Right-clicking a listed environment opened nothing. ReferenceBaseUi.MakeUi
answers a reference collection with the base VectorReferenceUi, which
names mnuReferenceChoices -- a list of jumps each gated to another class,
with sequence-only move commands. Every one evaluated false, the menu
built empty, and an empty menu is indistinguishable from a dead
right-click.

Only ReferenceCollectionUi names mnuEnvReferenceChoices, and MakeUi never
builds it. PhoneEnvReferenceView constructs it directly for this reason,
saying so in a comment; the host now does the same for a collection.

The menu carries Show in Environments list, which is enabled and is also
the Ctrl-click default, and the five insert commands, which are correctly
disabled until something gives them a caret.

Predates these editors: the resolution is the one the reference-vector
menus shipped with. It shows here because this is the row those editors
made worth right-clicking.

The new test asserts the menu id and that the built menu is not empty.
Suppressed, it fails on the id. The sequence row's existing test still
asserts the generic menu, so the change reaches collections only.

Full suite: 6238 run, 6176 passed, 62 skipped, none failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comment on lines +1720 to +1721
target.StringRepresentation =
TsStringUtils.MakeString(text, _cache.DefaultVernWs);

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.

@mark-sil this has now been addressed, along with some comment cleanup and other fixes I found. Ready for re-review.

@mark-sil mark-sil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mark-sil reviewed 20 files and all commit messages, and resolved 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on thejambi).

@thejambi
thejambi merged commit 9607242 into main Sep 25, 2026
9 checks passed
@thejambi
thejambi deleted the LT-22672-environments-inline-editing branch September 25, 2026 11:47
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.

3 participants