From 46be7eee0eb90fb2a3a878be3217e23737abd764 Mon Sep 17 00:00:00 2001 From: John Maxwell Date: Tue, 26 May 2026 07:58:59 -0700 Subject: [PATCH 1/2] Fix LT-18897: FLEx is silently changing completed analyses --- .../DomainImpl/AnalysisAdjuster.cs | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs b/src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs index e571b889..a0f91412 100644 --- a/src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs +++ b/src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs @@ -1455,9 +1455,9 @@ private void DetermineWhatToMove(int ichSource, int cchInsert, IStTxtPara source else if (cchInsert > 0 && seg.EndOffset <= ichSource + cchInsert) m_segPartlyMoved = seg; } - if (m_segPartlyMoved != null && m_segPartlyMoved.EndOffset == ichSource) + if (m_segPartlyMoved != null && DeltaIsEmpty(m_segPartlyMoved.EndOffset, ichSource, source)) { - // We are splitting the paragraph right at a segment boundary so there is + // We are splitting the paragraph at the equivalent of a segment boundary so there is // no need to copy this segment (as if it was split in the middle of this segment). m_segPartlyMoved = null; } @@ -1474,6 +1474,28 @@ private void DetermineWhatToMove(int ichSource, int cchInsert, IStTxtPara source } } + /// + /// Is the delta between the old segment boundary and the new segment boundary empty? + /// This fixes LT-18897. + /// + /// + /// + /// + /// + private bool DeltaIsEmpty(int endOffset, int ichSource, IStTxtPara source) + { + int start = Math.Min(endOffset, ichSource); + int end = Math.Max(endOffset, ichSource); + for (int i = start; i < end; i++) + { + if (!Char.IsWhiteSpace(source.Contents.Text[i])) + { + return false; + } + } + return true; + } + private List MoveAnalysisAndReferencesFromOldPara(int cchInsert, IStTxtPara source, bool fParaIsNew) { From 04c8e4e55eda64a2f1c37772c297a413f9cd3dcb Mon Sep 17 00:00:00 2001 From: John Maxwell Date: Tue, 26 May 2026 09:26:42 -0700 Subject: [PATCH 2/2] Remove parameters from summary as requested --- src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs b/src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs index a0f91412..98f82b4f 100644 --- a/src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs +++ b/src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs @@ -1478,10 +1478,6 @@ private void DetermineWhatToMove(int ichSource, int cchInsert, IStTxtPara source /// Is the delta between the old segment boundary and the new segment boundary empty? /// This fixes LT-18897. /// - /// - /// - /// - /// private bool DeltaIsEmpty(int endOffset, int ichSource, IStTxtPara source) { int start = Math.Min(endOffset, ichSource);