Context
Companion to #170. ISegment.BaselineText is ITsString (confirmed: liblcm/src/SIL.LCModel/InterfaceAdditions.cs:542 declares ITsString BaselineText { get; } — a read-only virtual computed property derived from ((IStTxtPara)Owner).Contents.GetSubstring(BeginOffset, EndOffset) per OverridesCellar.cs:4397).
#170 fixed the read path (GetBaselineText). The write paths in the same file have the same root-cause bug — they call .set_String(ws, mkstr) on an ITsString as if it were IMultiString.
Two problems compound here:
ITsString has no .set_String method → AttributeError at runtime
- Even if it did,
BaselineText is a computed, read-only property with no backing store — writes would have nothing to persist to. The backing store is IStTxtPara.Contents; correct edits must rewrite the paragraph's contents with the segment range replaced (or use LCM's ParagraphParser / AnalysisAdjuster services).
Affected sites (flexlibs2/code/TextsWords/SegmentOperations.py)
| Line |
Method |
Pattern |
| 279 |
SetBaselineText |
segment_obj.BaselineText.set_String(ws, mkstr) |
| 523 |
Create |
segment.BaselineText.set_String(ws, mkstr) |
| 688 |
GetSyncableProperties |
GetMultiStringDict(item.BaselineText) — IMultiString helper called on ITsString |
| 887 |
SplitSegment (first segment) |
first_segment.BaselineText.set_String(...) |
| 894 |
SplitSegment (second segment) |
second_segment.BaselineText.set_String(...) |
| 974 |
MergeSegments (first call) |
merged_segment.BaselineText.set_String(...) |
| 987 |
MergeSegments (second call) |
merged_segment.BaselineText.set_String(...) |
| 1359 |
RebuildSegments |
segment.BaselineText.set_String(...) |
Source
Domain audit during work on #170 / #171 (2026-05-30). Sweep covered all segment*.BaselineText.set_String and GetMultiStringDict(.*BaselineText) occurrences in the file.
Suggested fix shape (for the eventual cycle)
- Route segment-text edits through
IStTxtPara.Contents (e.g., assemble a new ITsString for Contents with the segment range replaced via ITsStrBldr), then trigger LCM's segment re-derivation.
- For
GetSyncableProperties: serialize BaselineText as a plain string (no WS dictionary), since it has no WS axis.
Context
Companion to #170.
ISegment.BaselineTextis ITsString (confirmed:liblcm/src/SIL.LCModel/InterfaceAdditions.cs:542declaresITsString BaselineText { get; }— a read-only virtual computed property derived from((IStTxtPara)Owner).Contents.GetSubstring(BeginOffset, EndOffset)perOverridesCellar.cs:4397).#170 fixed the read path (
GetBaselineText). The write paths in the same file have the same root-cause bug — they call.set_String(ws, mkstr)on an ITsString as if it were IMultiString.Two problems compound here:
ITsStringhas no.set_Stringmethod →AttributeErrorat runtimeBaselineTextis a computed, read-only property with no backing store — writes would have nothing to persist to. The backing store isIStTxtPara.Contents; correct edits must rewrite the paragraph's contents with the segment range replaced (or use LCM'sParagraphParser/AnalysisAdjusterservices).Affected sites (
flexlibs2/code/TextsWords/SegmentOperations.py)SetBaselineTextsegment_obj.BaselineText.set_String(ws, mkstr)Createsegment.BaselineText.set_String(ws, mkstr)GetSyncablePropertiesGetMultiStringDict(item.BaselineText)— IMultiString helper called on ITsStringSplitSegment(first segment)first_segment.BaselineText.set_String(...)SplitSegment(second segment)second_segment.BaselineText.set_String(...)MergeSegments(first call)merged_segment.BaselineText.set_String(...)MergeSegments(second call)merged_segment.BaselineText.set_String(...)RebuildSegmentssegment.BaselineText.set_String(...)Source
Domain audit during work on #170 / #171 (2026-05-30). Sweep covered all
segment*.BaselineText.set_StringandGetMultiStringDict(.*BaselineText)occurrences in the file.Suggested fix shape (for the eventual cycle)
IStTxtPara.Contents(e.g., assemble a newITsStringfor Contents with the segment range replaced viaITsStrBldr), then trigger LCM's segment re-derivation.GetSyncableProperties: serializeBaselineTextas a plain string (no WS dictionary), since it has no WS axis.