1.165 class text_change

Record of a single edit to a text_buffer: the range that was replaced and the text that replaced it. text_change objects are the payload of the text_buffer<-changes chain and let editor, fragment and view follow the buffer's edit history.

Positions are 0-based and use UTF-16 code units to match the LSP/DOM conventions other parts of xpce talk to.

See also
- class text_buffer
- class fragment
- class editor

1.165.1 Instance variables

text_change <- start_line: int
0-based line where the change starts.
text_change <- start_position: int
0-based position on text_change<-start_line, counted in UTF-16 units.
text_change <- end_line: int
0-based line where the change ends.
text_change <- end_position: int
0-based position on text_change<-end_line, counted in UTF-16 units.
text_change <- length: int
Length of the replaced region, in UTF-16 units.
text_change <- replacement: string*
Text used to replace the region (@nil for a pure deletion).

1.165.2 Send methods

text_change ->initialise: start_line=int, start_position=int, end_line=[int], end_position=[int], length=[int], replacement=[string*]
Build a change record from its range and replacement text. end_line/end_position default to start; length defaults to 0.

1.165.3 Get methods

text_change <-size: -> int
Approximate size of this change in bytes (its memory footprint). Used by text_buffer when bounding the size of the undo/redo history.