Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/SIL.LCModel/DomainImpl/AnalysisAdjuster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -1474,6 +1474,24 @@ private void DetermineWhatToMove(int ichSource, int cchInsert, IStTxtPara source
}
}

/// <summary>
/// Is the delta between the old segment boundary and the new segment boundary empty?
/// This fixes LT-18897.
/// </summary>
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<IAnalysisReference> MoveAnalysisAndReferencesFromOldPara(int cchInsert,
IStTxtPara source, bool fParaIsNew)
{
Expand Down
Loading