kopia lustrzana https://github.com/c9/core
fix clearUndo
rodzic
d2c6ec3c62
commit
68a6a14d90
|
@ -10,7 +10,7 @@ define(function(require, module, exports) {
|
||||||
var plugin = new Plugin("Ajax.org", main.consumes);
|
var plugin = new Plugin("Ajax.org", main.consumes);
|
||||||
var emit = plugin.getEmitter();
|
var emit = plugin.getEmitter();
|
||||||
|
|
||||||
var position = -1, mark = null, stack = [];
|
var position = -1, mark = -2, stack = [];
|
||||||
|
|
||||||
if (options)
|
if (options)
|
||||||
setState(options);
|
setState(options);
|
||||||
|
@ -55,7 +55,7 @@ define(function(require, module, exports) {
|
||||||
position = 0;
|
position = 0;
|
||||||
|
|
||||||
if (mark < position)
|
if (mark < position)
|
||||||
mark = -1;
|
mark = -2;
|
||||||
|
|
||||||
emit("change");
|
emit("change");
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ define(function(require, module, exports) {
|
||||||
stack = stack.slice(0, position + 1);
|
stack = stack.slice(0, position + 1);
|
||||||
|
|
||||||
if (mark > position)
|
if (mark > position)
|
||||||
mark = -1;
|
mark = -2;
|
||||||
|
|
||||||
if (!noEvent)
|
if (!noEvent)
|
||||||
emit("change");
|
emit("change");
|
||||||
|
@ -91,7 +91,7 @@ define(function(require, module, exports) {
|
||||||
position--;
|
position--;
|
||||||
|
|
||||||
if (mark == idx)
|
if (mark == idx)
|
||||||
mark = -1;
|
mark = -2;
|
||||||
else if (mark > idx)
|
else if (mark > idx)
|
||||||
mark--;
|
mark--;
|
||||||
|
|
||||||
|
@ -105,8 +105,7 @@ define(function(require, module, exports) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAtBookmark(){
|
function isAtBookmark(){
|
||||||
return mark !== null && mark == position
|
return mark == position;
|
||||||
|| mark === null && position == -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function item(idx) {
|
function item(idx) {
|
||||||
|
@ -146,7 +145,7 @@ define(function(require, module, exports) {
|
||||||
|
|
||||||
position = -1;
|
position = -1;
|
||||||
stack = [];
|
stack = [];
|
||||||
mark = null;
|
mark = -1;
|
||||||
|
|
||||||
emit("change");
|
emit("change");
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
|
||||||
expect(undo.position).to.equal(4);
|
expect(undo.position).to.equal(4);
|
||||||
undo.undo(); check++;
|
undo.undo(); check++;
|
||||||
|
|
||||||
undo.setState({ position : -1, stack : stack, mark : null }); check++;
|
undo.setState({ position : -1, stack : stack, mark : -1 }); check++;
|
||||||
expect(undo.isAtBookmark()).to.equal(true);
|
expect(undo.isAtBookmark()).to.equal(true);
|
||||||
expect(data).to.deep.equal(["a", "q"]);
|
expect(data).to.deep.equal(["a", "q"]);
|
||||||
checkCount();
|
checkCount();
|
||||||
|
|
Ładowanie…
Reference in New Issue