Word range viw

This commit is contained in:
斟酌 鵬兄 2016-03-30 21:12:01 +08:00
parent 9faf2b4921
commit 030fb3226b
2 changed files with 26 additions and 6 deletions

View File

@ -13,6 +13,16 @@
/** @type {Components.Vim.Cursor.IAction} */ /** @type {Components.Vim.Cursor.IAction} */
var VISUAL = function( Cursor ) 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} */ /** @type {Components.Vim.Cursor} */
this.__cursor = Cursor; this.__cursor = Cursor;
@ -20,11 +30,6 @@
this.__startP = { x: Cursor.X, y: Cursor.Y, p: Cursor.P }; this.__startP = { x: Cursor.X, y: Cursor.Y, p: Cursor.P };
this.__start = Cursor.PStart; this.__start = Cursor.PStart;
this.__selStart = Cursor.PStart; this.__selStart = Cursor.PStart;
this.__msg = Mesg( "VISUAL" );
this.__leaveMesg = "";
Cursor.blink = false;
Cursor.pSpace = true;
}; };
VISUAL.prototype.allowMovement = true; VISUAL.prototype.allowMovement = true;
@ -84,6 +89,22 @@
} }
else 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 prevPos = this.__start;
var newPos = cur.PStart; var newPos = cur.PStart;

View File

@ -322,7 +322,6 @@
); );
e2.__range = WordMatch; e2.__range = WordMatch;
}, W ); }, W );
this.__comp( e, function(){ this.__comp( e, function(){
debug.Info( "Bracket boundary [" ); debug.Info( "Bracket boundary [" );