Skip to content

StringTextSource

ClassTextStudioTextStudio
public class StringTextSource : ITextStudioTextSource

Mutable in-memory text source that tracks replacements and append operations for incremental compilation.

public StringTextSource(string text = "")

Creates a source with optional initial markup.

Parameters

Name Type Description
text System.String Initial markup. A null value is treated as empty when first processed.

public string GetCanonicalText()

Gets the complete canonical markup represented by the source.

Returns

System.String: Current markup. Implementations should return an empty string instead of null.

public uint GetVersion()

Gets a monotonically changing value used to detect source mutations without comparing text.

Returns

System.UInt32

public void SetText(string text)

Replaces canonical markup and notifies listeners when its value changes.

Parameters

Name Type Description
text System.String Replacement markup.
public void AppendText(string markup)

Append markup to the current text without treating it as a fresh replacement. Bumps the version so downstream stages rebuild, but callers that want to preserve reveal/animation state for the already-shown prefix can key off text length diffs.

Parameters

Name Type
markup System.String

public event Action Changed

Occurs after canonical text or its effective interpretation changes.

Returns

System.Action