Package jetbrains.mps.text
Interface TextBuffer
- 
- All Known Implementing Classes:
 TextBufferImpl
public interface TextBufferContents of aTextUnitbeing edited/populated. Consists of text areas. Active text chunk/area could be switched withpushTextArea(TextAreaToken)andpopTextArea(). There's default, top-most text area that can't be removed, i.e. one can treat freshTextBufferas being initialized likeTextBuffer tb; tb.pushTextArea(defaultAreaToken);
Supports (nested) text markers, seepushMark(). FIXME Perhaps, shall introduce either BinaryBuffer or BinaryArea to support binary (or partly binary) files- Since:
 - 3.3
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TextAreaarea()BufferLayoutnewLayout()Factory method to instantiate a layout capable to deal with this buffer instance.TextMarkpopMark()TextBufferpopTextArea()Revert to previous active areaTextBufferpushMark()Indicate start location of a marker, which is retrieved withpopMark()At the moment, as the name (push/pop) indicates, nested marks are supported.TextBufferpushTextArea(TextAreaToken areaIdentity)Switch active area.BufferSnapshotsnapshot(BufferLayout layout)Capture actual state of the buffer, text chunks positioned in accordance with suppliedlayout. 
 - 
 
- 
- 
Method Detail
- 
pushTextArea
TextBuffer pushTextArea(@NotNull TextAreaToken areaIdentity)
Switch active area. FIXME describe whether nested push with the same token is allowed (present impl does allow, is it smth we'd like to use?)- Parameters:
 areaIdentity- identifies text chunk to become active for output- Returns:
 thisfor convenience
 
- 
popTextArea
TextBuffer popTextArea()
Revert to previous active area- Returns:
 thisfor convenience
 
- 
pushMark
TextBuffer pushMark()
Indicate start location of a marker, which is retrieved withpopMark()At the moment, as the name (push/pop) indicates, nested marks are supported. Nested means m1 starts, m2 starts, m2 ends, m1 ends. Intersecting marks, m1 starts, m2 starts, m1 ends, m2 ends are not supported, if there's need to, API shall get extended with mark identity. 
- 
newLayout
@NotNull BufferLayout newLayout()
Factory method to instantiate a layout capable to deal with this buffer instance.- Returns:
 - new instance suitable for subsequent argument to 
snapshot(BufferLayout) 
 
- 
snapshot
@NotNull BufferSnapshot snapshot(@NotNull BufferLayout layout)
Capture actual state of the buffer, text chunks positioned in accordance with suppliedlayout.- Parameters:
 layout- describes how text chunks of the buffer shall be ordered.- Returns:
 - snapshot of the text in the buffer. The value is independent from subsequent buffer modifications
 
 
 - 
 
 -