|
@@ -67,7 +67,8 @@ export class SUndoStack extends SObject {
|
|
|
* 清空堆栈
|
|
|
*/
|
|
|
clear(): void {
|
|
|
- // this.cmdStack
|
|
|
+ this.cmdStack.length = 0;
|
|
|
+ this._index = -1;
|
|
|
} // Function clear()
|
|
|
|
|
|
/**
|
|
@@ -87,7 +88,7 @@ export class SUndoStack extends SObject {
|
|
|
/**
|
|
|
* 统计命令栈中命令的数量
|
|
|
*/
|
|
|
- cout(): number {
|
|
|
+ count(): number {
|
|
|
return this.cmdStack.length;
|
|
|
} // Function cout()
|
|
|
|
|
@@ -97,6 +98,7 @@ export class SUndoStack extends SObject {
|
|
|
* @param cmd 被添加的命令
|
|
|
*/
|
|
|
push(cmd: SUndoCommand): void {
|
|
|
+ this.cmdStack.length = this._index + 1;
|
|
|
this.cmdStack.push(cmd);
|
|
|
this._index = this.cmdStack.length - 1;
|
|
|
} // Function push()
|