commit 44fec5abfdcce644b6913d01a8ce2971cca8dd87
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2016-03-16T23:16:06Z |
| subject | Store the stacks indefinitely |
commit 44fec5abfdcce644b6913d01a8ce2971cca8dd87
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2016-03-16T23:16:06Z
Store the stacks indefinitely
---
botanjs/src/Components/Vim/State/Recorder.js | 10 ++++++++--
botanjs/src/Components/Vim/State/Stack.js | 5 +----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/botanjs/src/Components/Vim/State/Recorder.js b/botanjs/src/Components/Vim/State/Recorder.js
index 1ba8a59..8e095f4 100644
--- a/botanjs/src/Components/Vim/State/Recorder.js
+++ b/botanjs/src/Components/Vim/State/Recorder.js
@@ -4,7 +4,9 @@
var Recorder = function()
{
this.__steps = [];
+ this.__stacks = [];
this.__i = 0;
+ this.__j = 0;
};
Recorder.prototype.undo = function()
@@ -31,8 +33,12 @@
Recorder.prototype.record = function( StateObj )
{
- this.__steps[ this.__i ] = StateObj;
- StateObj.id = this.__i ++;
+ this.__steps[ this.__i ++ ] = StateObj;
+ this.__stacks[ this.__j ++ ] = StateObj;
+
+ delete this.__steps[ this.__i ];
+
+ StateObj.id = this.__j;
};
ns[ NS_EXPORT ]( EX_CLASS, "Recorder", Recorder );
diff --git a/botanjs/src/Components/Vim/State/Stack.js b/botanjs/src/Components/Vim/State/Stack.js
index 0e7d561..5096ccc 100644
--- a/botanjs/src/Components/Vim/State/Stack.js
+++ b/botanjs/src/Components/Vim/State/Stack.js
@@ -4,10 +4,7 @@
/** @type {Components.Vim.DateTime} */
var RelativeTime = __import( "Components.Vim.DateTime.RelativeTime" );
- var Stack = function()
- {
-
- };
+ var Stack = function() { };
Stack.prototype.store = function( handler )
{