commit 030fb3226bc8abd668d11e24d0de7b19b2ee48b5
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2016-03-30T13:12:01Z |
| subject | Word range viw |
commit 030fb3226bc8abd668d11e24d0de7b19b2ee48b5
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2016-03-30T13:12:01Z
Word range viw
---
botanjs/src/Components/Vim/Actions/VISUAL.js | 31 +++++++++++++++++++++++-----
botanjs/src/Components/Vim/Controls.js | 1 -
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/botanjs/src/Components/Vim/Actions/VISUAL.js b/botanjs/src/Components/Vim/Actions/VISUAL.js
index 8072e6b..1574d95 100644
--- a/botanjs/src/Components/Vim/Actions/VISUAL.js
+++ b/botanjs/src/Components/Vim/Actions/VISUAL.js
@@ -13,6 +13,16 @@
/** @type {Components.Vim.Cursor.IAction} */
var VISUAL = function( Cursor )
+ {
+ this.__reset( Cursor );
+ this.__msg = Mesg( "VISUAL" );
+ this.__leaveMesg = "";
+
+ Cursor.blink = false;
+ Cursor.pSpace = true;
+ };
+
+ VISUAL.prototype.__reset = function( Cursor )
{
/** @type {Components.Vim.Cursor} */
this.__cursor = Cursor;
@@ -20,11 +30,6 @@
this.__startP = { x: Cursor.X, y: Cursor.Y, p: Cursor.P };
this.__start = Cursor.PStart;
this.__selStart = Cursor.PStart;
- this.__msg = Mesg( "VISUAL" );
- this.__leaveMesg = "";
-
- Cursor.blink = false;
- Cursor.pSpace = true;
};
VISUAL.prototype.allowMovement = true;
@@ -84,6 +89,22 @@
}
else
{
+ if( e.range )
+ {
+ cur.suppressEvent();
+
+ var r = e.range;
+
+ if( cur.aPos == this.__startaP )
+ {
+ cur.moveX( r.open - this.__startaP );
+ this.__reset( cur );
+ }
+
+ cur.unsuppressEvent();
+ cur.moveX( r.close - cur.aPos );
+ }
+
var prevPos = this.__start;
var newPos = cur.PStart;
diff --git a/botanjs/src/Components/Vim/Controls.js b/botanjs/src/Components/Vim/Controls.js
index 29e86c4..f318060 100644
--- a/botanjs/src/Components/Vim/Controls.js
+++ b/botanjs/src/Components/Vim/Controls.js
@@ -322,7 +322,6 @@
);
e2.__range = WordMatch;
-
}, W );
this.__comp( e, function(){
debug.Info( "Bracket boundary [" );