1
// Scintilla source code edit control
3
** Manages the text of the document.
5
// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
6
// The License.txt file describes the conditions under which this software may be distributed.
15
// Interface to per-line data that wants to see each line insertion and deletion
19
virtual void Init()=0;
20
virtual void InsertLine(int)=0;
21
virtual void RemoveLine(int)=0;
25
* The line vector contains information about each of the lines in a cell buffer.
37
void SetPerLine(PerLine *pl);
39
void InsertText(int line, int delta);
40
void InsertLine(int line, int position, bool lineStart);
41
void SetLineStart(int line, int position);
42
void RemoveLine(int line);
44
return starts.Partitions();
46
int LineFromPosition(int pos) const;
47
int LineStart(int line) const {
48
return starts.PositionFromPartition(line);
51
int MarkValue(int line);
52
int AddMark(int line, int marker);
53
void MergeMarkers(int pos);
54
void DeleteMark(int line, int markerNum, bool all);
55
void DeleteMarkFromHandle(int markerHandle);
56
int LineFromHandle(int markerHandle);
59
int SetLevel(int line, int level);
60
int GetLevel(int line);
62
int SetLineState(int line, int state);
63
int GetLineState(int line);
64
int GetMaxLineState();
68
enum actionType { insertAction, removeAction, startAction, containerAction };
71
* Actions are used to store all the information required to perform one undo/redo step.
83
void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0, bool mayCoalesce_=true);
85
void Grab(Action *source);
96
int undoSequenceDepth;
99
void EnsureUndoRoom();
105
void AppendAction(actionType at, int position, char *data, int length, bool &startSequence, bool mayCoalesce=true);
107
void BeginUndoAction();
108
void EndUndoAction();
109
void DropUndoSequence();
110
void DeleteUndoHistory();
112
/// The save point is a marker in the undo stack where the container has stated that
113
/// the buffer was saved. Undo and redo can move over the save point.
115
bool IsSavePoint() const;
117
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
118
/// called that many times. Similarly for redo.
119
bool CanUndo() const;
121
const Action &GetUndoStep() const;
122
void CompletedUndoStep();
123
bool CanRedo() const;
125
const Action &GetRedoStep() const;
126
void CompletedRedoStep();
130
* Holder for an expandable array of characters that supports undo and line markers.
131
* Based on article "Data Structures in a Bit-Mapped Text Editor"
132
* by Wilfred J. Hansen, Byte January 1987, page 183.
136
SplitVector<char> substance;
137
SplitVector<char> style;
145
/// Actions without undo
146
void BasicInsertString(int position, const char *s, int insertLength);
147
void BasicDeleteChars(int position, int deleteLength);
154
/// Retrieving positions outside the range of the buffer works and returns 0
155
char CharAt(int position) const;
156
void GetCharRange(char *buffer, int position, int lengthRetrieve) const;
157
char StyleAt(int position) const;
158
void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const;
159
const char *BufferPointer();
162
void Allocate(int newSize);
163
void SetPerLine(PerLine *pl);
165
int LineStart(int line) const;
166
int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); }
167
void InsertLine(int line, int position, bool lineStart);
168
void RemoveLine(int line);
169
const char *InsertString(int position, const char *s, int insertLength, bool &startSequence);
171
/// Setting styles for positions outside the range of the buffer is safe and has no effect.
172
/// @return true if the style of a character is changed.
173
bool SetStyleAt(int position, char styleValue, char mask='\377');
174
bool SetStyleFor(int position, int length, char styleValue, char mask);
176
const char *DeleteChars(int position, int deleteLength, bool &startSequence);
178
bool IsReadOnly() const;
179
void SetReadOnly(bool set);
181
/// The save point is a marker in the undo stack where the container has stated that
182
/// the buffer was saved. Undo and redo can move over the save point.
186
bool SetUndoCollection(bool collectUndo);
187
bool IsCollectingUndo() const;
188
void BeginUndoAction();
189
void EndUndoAction();
190
void AddUndoAction(int token, bool mayCoalesce);
191
void DeleteUndoHistory();
193
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
194
/// called that many times. Similarly for redo.
197
const Action &GetUndoStep() const;
198
void PerformUndoStep();
201
const Action &GetRedoStep() const;
202
void PerformRedoStep();