DocumentEditScope
A mutable view of a text document handed to DocumentState.edit. Calls made on it inside the edit { } block are applied to the document as one compound change, so the field observes a single settled edit rather than each intermediate step.
Offsets address the buffer's current content and shift as edits are applied, exactly as they do against the underlying document: an insert at offset 2 makes a following delete at offset 2 operate on the text after the insertion.
Every call that writes text has an overload taking an AttributeSet, the attributes the written run carries - a bold word, a colored span, a link. They reach a document that models attributes: the styled document a TextPane renders, or the one an editable EditorPane's kit builds. A document that holds characters alone - the plain text a TextField or a TextArea renders - ignores them, so the text arrives unstyled rather than refused.
See also
Functions
Appends text to the end of the buffer.
Appends text carrying attributes to the end of the buffer.
Inserts text carrying attributes at offset, shifting following content right.
Places the caret at the end of the buffer as it stands once the block completes.
Replaces the characters in [start, end) with text.
Replaces the characters in [start, end) with text carrying attributes.
Replaces the whole buffer with text.
Replaces the whole buffer with text carrying attributes.