aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/CellBuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/CellBuffer.h')
-rw-r--r--src/CellBuffer.h70
1 files changed, 17 insertions, 53 deletions
diff --git a/src/CellBuffer.h b/src/CellBuffer.h
index 6cf8ad056..395f75f0e 100644
--- a/src/CellBuffer.h
+++ b/src/CellBuffer.h
@@ -12,33 +12,12 @@
namespace Scintilla {
#endif
-/**
- * This holds the marker identifier and the marker type to display.
- * MarkerHandleNumbers are members of lists.
- */
-struct MarkerHandleNumber {
- int handle;
- int number;
- MarkerHandleNumber *next;
-};
-
-/**
- * A marker handle set contains any number of MarkerHandleNumbers.
- */
-class MarkerHandleSet {
- MarkerHandleNumber *root;
-
+// Interface to per-line data that wants to see each line insertion and deletion
+class PerLine {
public:
- MarkerHandleSet();
- ~MarkerHandleSet();
- int Length() const;
- int NumberFromHandle(int handle) const;
- int MarkValue() const; ///< Bit set of marker numbers.
- bool Contains(int handle) const;
- bool InsertHandle(int handle, int markerNum);
- void RemoveHandle(int handle);
- bool RemoveNumber(int markerNum);
- void CombineWith(MarkerHandleSet *other);
+ virtual ~PerLine() {}
+ virtual void InsertLine(int)=0;
+ virtual void RemoveLine(int)=0;
};
/**
@@ -47,21 +26,14 @@ public:
class LineVector {
Partitioning starts;
- SplitVector<MarkerHandleSet *> markers;
- SplitVector<int> levels;
- /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
- int handleCurrent;
+ PerLine *perLine;
public:
LineVector();
~LineVector();
void Init();
-
- void ExpandLevels(int sizeNew=-1);
- void ClearLevels();
- int SetLevel(int line, int level);
- int GetLevel(int line);
+ void SetPerLine(PerLine *pl);
void InsertText(int line, int delta);
void InsertLine(int line, int position);
@@ -81,6 +53,15 @@ public:
void DeleteMark(int line, int markerNum, bool all);
void DeleteMarkFromHandle(int markerHandle);
int LineFromHandle(int markerHandle);
+
+ void ClearLevels();
+ int SetLevel(int line, int level);
+ int GetLevel(int line);
+
+ int SetLineState(int line, int state);
+ int GetLineState(int line);
+ int GetMaxLineState();
+
};
enum actionType { insertAction, removeAction, startAction, containerAction };
@@ -160,8 +141,6 @@ private:
LineVector lv;
- SplitVector<int> lineStates;
-
public:
CellBuffer();
@@ -175,6 +154,7 @@ public:
int Length() const;
void Allocate(int newSize);
+ void SetPerLine(PerLine *pl);
int Lines() const;
int LineStart(int line) const;
int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
@@ -197,14 +177,6 @@ public:
void SetSavePoint();
bool IsSavePoint();
- /// Line marker functions
- int AddMark(int line, int markerNum);
- void DeleteMark(int line, int markerNum);
- void DeleteMarkFromHandle(int markerHandle);
- int GetMark(int line);
- void DeleteAllMarks(int markerNum);
- int LineFromHandle(int markerHandle);
-
/// Actions without undo
void BasicInsertString(int position, const char *s, int insertLength);
void BasicDeleteChars(int position, int deleteLength);
@@ -226,14 +198,6 @@ public:
int StartRedo();
const Action &GetRedoStep() const;
void PerformRedoStep();
-
- int SetLineState(int line, int state);
- int GetLineState(int line);
- int GetMaxLineState();
-
- int SetLevel(int line, int level);
- int GetLevel(int line);
- void ClearLevels();
};
#ifdef SCI_NAMESPACE