aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/CellBuffer.h
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2000-03-22 12:16:54 +0000
committernyamatongwe <devnull@localhost>2000-03-22 12:16:54 +0000
commitff69e140ac7634ab8ec4365f97f0adae27692b53 (patch)
tree7c44f53d74ea3a4303084e24b5a40e8139bc9a01 /src/CellBuffer.h
parent06795dc71160ed0b5ff3a2919e6fd9ef7adc8a4c (diff)
downloadscintilla-mirror-ff69e140ac7634ab8ec4365f97f0adae27692b53.tar.gz
Split UndoHistory out of CellBuffer.
Fixed coalescing of nodes in the undo history. Added LineCut, LineDelete, LineTranspose, UpperCase and LowerCase keyboard commands and added keys for them. Added UUID lexical class to CPP lexer.
Diffstat (limited to 'src/CellBuffer.h')
-rw-r--r--src/CellBuffer.h49
1 files changed, 38 insertions, 11 deletions
diff --git a/src/CellBuffer.h b/src/CellBuffer.h
index 5fbe2ea8a..6e052077e 100644
--- a/src/CellBuffer.h
+++ b/src/CellBuffer.h
@@ -89,6 +89,42 @@ public:
enum undoCollectionType { undoCollectNone, undoCollectAutoStart, undoCollectManualStart };
+class UndoHistory {
+ Action *actions;
+ int lenActions;
+ int maxAction;
+ int currentAction;
+ int undoSequenceDepth;
+ int savePoint;
+
+ void EnsureUndoRoom();
+
+public:
+ UndoHistory();
+ ~UndoHistory();
+
+ void AppendAction(actionType at, int position, char *data, int length);
+
+ void BeginUndoAction();
+ void EndUndoAction();
+ void DropUndoSequence();
+ void DeleteUndoHistory();
+
+ // The save point is a marker in the undo stack where the container has stated that
+ // the buffer was saved. Undo and redo can move over the save point.
+ void SetSavePoint();
+ bool IsSavePoint() const;
+
+ // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
+ // called that many times. Similarly for redo.
+ bool CanUndo() const;
+ int StartUndo();
+ const Action &UndoStep();
+ bool CanRedo() const;
+ int StartRedo();
+ const Action &RedoStep();
+};
+
// Holder for an expandable array of characters that supports undo and line markers
// Based on article "Data Structures in a Bit-Mapped Text Editor"
// by Wilfred J. Hansen, Byte January 1987, page 183
@@ -102,13 +138,8 @@ private:
char *part2body;
bool readOnly;
- Action *actions;
- int lenActions;
- int maxAction;
- int currentAction;
undoCollectionType collectingUndo;
- int undoSequenceDepth;
- int savePoint;
+ UndoHistory uh;
LineVector lv;
@@ -117,9 +148,6 @@ private:
void GapTo(int position);
void RoomFor(int insertionLength);
- void EnsureUndoRoom();
- void AppendAction(actionType at, int position, char *data, int length);
-
inline char ByteAt(int position);
void SetByteAt(int position, char ch);
@@ -170,12 +198,11 @@ public:
undoCollectionType SetUndoCollection(undoCollectionType collectUndo);
bool IsCollectingUndo();
- void AppendUndoStartAction();
void BeginUndoAction();
void EndUndoAction();
void DeleteUndoHistory();
- // To perform an undo, StartUndo is called to retreive the number of steps, then UndoStep is
+ // To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
// called that many times. Similarly for redo.
bool CanUndo();
int StartUndo();