|
@@ -25,7 +25,7 @@ class NotusHistory {
|
25
|
25
|
|
26
|
26
|
NotusHistory(
|
27
|
27
|
{this.ignoreChange = false,
|
28
|
|
- this.interval = 400,
|
|
28
|
+ this.interval = 800,
|
29
|
29
|
this.maxStack = 100,
|
30
|
30
|
this.userOnly = false,
|
31
|
31
|
this.lastRecorded = 0});
|
|
@@ -83,8 +83,8 @@ class NotusHistory {
|
83
|
83
|
}
|
84
|
84
|
}
|
85
|
85
|
|
86
|
|
- void _change(NotusDocument doc, List<Delta> source, List<Delta> dest) {
|
87
|
|
- if (source.length == 0) return;
|
|
86
|
+ Delta _change(NotusDocument doc, List<Delta> source, List<Delta> dest) {
|
|
87
|
+ if (source.length == 0) return Delta();
|
88
|
88
|
Delta delta = source.removeLast();
|
89
|
89
|
Delta base = doc.toDelta();
|
90
|
90
|
Delta inverseDelta = delta.invert(base);
|
|
@@ -93,14 +93,15 @@ class NotusHistory {
|
93
|
93
|
this.ignoreChange = true;
|
94
|
94
|
doc.compose(delta, ChangeSource.local, history: true);
|
95
|
95
|
this.ignoreChange = false;
|
|
96
|
+ return delta;
|
96
|
97
|
}
|
97
|
98
|
|
98
|
|
- void undo(NotusDocument doc) {
|
99
|
|
- _change(doc, stack.undo, stack.redo);
|
|
99
|
+ Delta undo(NotusDocument doc) {
|
|
100
|
+ return _change(doc, stack.undo, stack.redo);
|
100
|
101
|
}
|
101
|
102
|
|
102
|
|
- void redo(NotusDocument doc) {
|
103
|
|
- _change(doc, stack.redo, stack.undo);
|
|
103
|
+ Delta redo(NotusDocument doc) {
|
|
104
|
+ return _change(doc, stack.redo, stack.undo);
|
104
|
105
|
}
|
105
|
106
|
}
|
106
|
107
|
|