Skip to content

Fix LT-22539: Loss of focus from gloss field#931

Open
jtmaxwell3 wants to merge 8 commits into
mainfrom
LT-22539
Open

Fix LT-22539: Loss of focus from gloss field#931
jtmaxwell3 wants to merge 8 commits into
mainfrom
LT-22539

Conversation

@jtmaxwell3

@jtmaxwell3 jtmaxwell3 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

This fixes https://jira.sil.org/browse/LT-22539, https://jira.sil.org/browse/LT-22534, and https://jira.sil.org/browse/LT-22541. I discovered that MoveFocusBoxIntoPlace caused the secondary cache to be cleared, which meant that any user edits were lost. So I replaced it with UpdateField and EstablishDefaultSense. EstablishDefaultSense is an existing function which updates the sense name and msa in the secondary cache and the display. FocusBoxController.UpdateField suppresses the focus change to fix LT-22539. SandboxBase.UpdateField fixes LT-22534 and LT-22541. I put all of these fixes in the same commit to make sure that they all worked together.


This change is Reviewable

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

NUnit Tests

    1 files  ± 0      1 suites  ±0   10m 14s ⏱️ - 1m 34s
4 251 tests +41  4 178 ✅ +38  73 💤 +3  0 ❌ ±0 
4 260 runs  +41  4 187 ✅ +38  73 💤 +3  0 ❌ ±0 

Results for commit 8f391e6. ± Comparison against base commit 53d5dbb.

This pull request removes 2 and adds 43 tests. Note that renamed tests count towards both.
SIL.FieldWorks.Common.RootSites.SimpleRootSiteTests.RenderEngineFactoryTests ‑ get_Renderer_Graphite
SIL.FieldWorks.Common.RootSites.SimpleRootSiteTests.RenderEngineFactoryTests ‑ get_Renderer_Uniscribe
LexTextDllTests.AreaListenerTests ‑ GetToolForList_KnownList_ReturnsConfiguredToolName
LexTextDllTests.AreaListenerTests ‑ GetToolForList_UnknownList_ReturnsCustomToolName
SIL.FieldWorks.Common.FwUtils.FontFeatureSettingsTests ‑ NormalizePreservingLegacy_NormalizesOpenTypeFeatures
SIL.FieldWorks.Common.FwUtils.FontFeatureSettingsTests ‑ NormalizePreservingLegacy_NormalizesOpenTypeFeaturesThatStartWithPunctuation
SIL.FieldWorks.Common.FwUtils.FontFeatureSettingsTests ‑ NormalizePreservingLegacy_PreservesNumericGraphiteFeatureIds
SIL.FieldWorks.Common.FwUtils.FontFeatureSettingsTests ‑ Normalize_ReturnsDeterministicRendererNeutralString
SIL.FieldWorks.Common.FwUtils.FontFeatureSettingsTests ‑ Parse_AcceptsCustomPrintableAsciiTags
SIL.FieldWorks.Common.FwUtils.FontFeatureSettingsTests ‑ Parse_IgnoresInvalidEntries
SIL.FieldWorks.Common.FwUtils.FontFeatureSettingsTests ‑ Parse_LastValueWinsForDuplicateTags
SIL.FieldWorks.Common.FwUtils.FontFeatureSettingsTests ‑ Parse_LogsIgnoredInvalidEntries
…

♻️ This comment has been updated with latest results.

@jtmaxwell3 jtmaxwell3 marked this pull request as draft June 5, 2026 20:29
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

Render comparison artifacts

Render snapshot failures were reported in 3912e756d998 run 27293398351.1, but the latest run 6bd317098f96 run 27423253555.1 is clean.

This comment will be replaced if a future run produces render snapshot failures again.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

⚠️ Commit Message Format Issues ⚠️
commit 3cce58eea3:
1: T3 Title has trailing punctuation (.): "This fixes LT-22541."

@jtmaxwell3 jtmaxwell3 marked this pull request as ready for review June 10, 2026 17:37

Copilot AI 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.

Pull request overview

Fixes interlinear Focus Box refresh behavior so edits aren’t lost and focus isn’t stolen when related lexicon/MSA data changes (LT-22539 / LT-22534 / LT-22541). The change replaces a “reselect + move focus box” refresh with a targeted field update that aims to preserve the secondary cache and user focus.

Changes:

  • Route InterlinDocForAnalysis.PropChanged refreshes through FocusBoxController.UpdateField instead of reselecting the occurrence and repositioning the focus box.
  • Add SandboxBase.UpdateField to refresh secondary-cache sense/MSA display via EstablishDefaultSense.
  • Add plumbing (IAnalysisControlInternal.UpdateField) and update test doubles/designer usings accordingly.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
Src/LexText/Interlinear/SandboxBase.cs Adds secondary-cache refresh helper (UpdateField) and a morph lookup utility to update displayed sense/MSA without clearing caches.
Src/LexText/Interlinear/ITextDllTests/InterlinDocForAnalysisTests.cs Updates mock sandbox to satisfy new interface method.
Src/LexText/Interlinear/InterlinDocForAnalysis.Designer.cs Adds (currently unused) using directive.
Src/LexText/Interlinear/InterlinDocForAnalysis.cs Switches PropChanged refresh from “reselect/move” to FocusBox.UpdateField.
Src/LexText/Interlinear/FocusBoxController.cs Adds focus-suppression flag and UpdateField forwarding; extends internal sandbox interface.
Files not reviewed (1)
  • Src/LexText/Interlinear/InterlinDocForAnalysis.Designer.cs: Language not supported

Comment on lines +1659 to +1661
public void UpdateField(int hvo, int flid)
{
ICmObject hvoObject = Caches.MainCache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
Comment on lines +1670 to +1671
if (hvoObject != null && hvoObject.Owner is IMoMorphSynAnalysis msa)
{
Comment on lines +318 to +330
public void UpdateField(int hvo, int flid)
{
try
{
// This fixes LT-22539.
suppressFocusChange = true;
m_sandbox.UpdateField(hvo, flid);
}
finally
{
suppressFocusChange = false;
}
}
get { return m_sandbox.IsDirty; }
}

private bool suppressFocusChange = false;
// This software is licensed under the LGPL, version 2.1 or later
// (http://www.gnu.org/licenses/lgpl-2.1.html)

using SIL.FieldWorks.Common.FwUtils;
Comment on lines +561 to +564
public void UpdateField(int hvo, int flid)
{
throw new NotImplementedException();
}
Comment on lines +1659 to +1663
public void UpdateField(int hvo, int flid)
{
ICmObject hvoObject = Caches.MainCache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvo);
if (hvoObject is ILexSense lexSense && lexSense.Owner is ILexEntry lexEntry)
{
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.

2 participants