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 ) {