commit f85e65c23e21812381995c9bf9f89e0a9416b0b1
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2017-01-28T05:20:01Z |
| subject | Fixed last line cannot be dd-ed |
commit f85e65c23e21812381995c9bf9f89e0a9416b0b1
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2017-01-28T05:20:01Z
Fixed last line cannot be dd-ed
---
botanjs/src/Components/Vim/Actions/DELETE.js | 3 +++
botanjs/src/Components/Vim/VimArea.js | 8 +++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/botanjs/src/Components/Vim/Actions/DELETE.js b/botanjs/src/Components/Vim/Actions/DELETE.js
index a5a7f6c..1f58fae 100644
--- a/botanjs/src/Components/Vim/Actions/DELETE.js
+++ b/botanjs/src/Components/Vim/Actions/DELETE.js
@@ -153,6 +153,9 @@
e = sp;
}
+ // For removing the very last line
+ if( c[ sp ] == undefined ) s --;
+
var removed = c.substring( s, e + 1 );
reg.change( removed, newLine );
diff --git a/botanjs/src/Components/Vim/VimArea.js b/botanjs/src/Components/Vim/VimArea.js
index a1b57f5..30228b5 100644
--- a/botanjs/src/Components/Vim/VimArea.js
+++ b/botanjs/src/Components/Vim/VimArea.js
@@ -87,11 +87,11 @@
if( detectScreenSize )
{
var val = element.value;
- this.__testScreen(function() { _self.VisualizeVimFrame( val ); });
+ this.__testScreen(function() { _self.__visualize( val ); });
}
else
{
- this.VisualizeVimFrame( element.value );
+ this.__visualize( element.value );
}
// Set buffer index
@@ -177,7 +177,8 @@
}
};
- VimArea.prototype.VisualizeVimFrame = function( content )
+ // Visualize the Vim Frame
+ VimArea.prototype.__visualize = function( content )
{
var _self = this;
this.content = content;
@@ -263,6 +264,7 @@
);
this.stage.addEventListeners( this.__stagedEvents );
+ this.dispatchEvent( new BotanEvent( "Visualized" ) );
};
VimArea.prototype.demo = function( seq )