Some placeholders

This commit is contained in:
斟酌 鵬兄 2016-03-29 03:51:55 +08:00
parent 78f8a20a5d
commit 3f687cb704
3 changed files with 91 additions and 22 deletions

View File

@ -19,6 +19,7 @@
/** @type {Components.Vim.Cursor} */
this.__cursor = Cursor;
this.__nline = 0;
this.__startX = Cursor.aPos;
};
DELETE.prototype.allowMovement = true;
@ -32,12 +33,28 @@
{
e.preventDefault();
/** @type {Components.Vim.State.Registers} */
var reg = e.target.registers;
var cur = this.__cursor;
var feeder = cur.feeder;
var Triggered = false;
if( sp == undefined && this.__startX != cur.aPos )
{
Triggered = true;
if( e.kMap( "l" ) )
{
cur.moveX( -1 );
}
sp = this.__startX;
}
else if( sp == undefined ) return;
var c = feeder.content;
var s = sp;
@ -77,6 +94,8 @@
cur.rec.record( stack );
feeder.pan();
return Triggered;
};
DELETE.prototype.getMessage = function()

View File

@ -17,6 +17,7 @@
/** @type {Components.Vim.Cursor} */
this.__cursor = Cursor;
this.__startaP = Cursor.aPos;
this.__startP = { x: Cursor.X, y: Cursor.Y, p: Cursor.P };
this.__start = Cursor.PStart;
this.__selStart = Cursor.PStart;
this.__msg = Mesg( "VISUAL" );
@ -45,16 +46,44 @@
var cur = this.__cursor;
var Action = null;
switch( true )
if( e.kMap( "y" ) )
{
case e.kMap( "y" ):
Action = new YANK( cur );
break;
case e.kMap( "d" ):
}
else if( e.kMap( "d" ) )
{
Action = new DELETE( cur );
break;
}
if( Action )
{
cur.suppressEvent();
// Low-level cursor position adjustment
// this swap the cursor direction from LTR to RTL
// i.e. treat all delete as "e<----s" flow
// to keep the cursor position as the top on UNDO / REDO
if( Action.constructor == DELETE && this.__startaP < cur.aPos )
{
this.__startaP = cur.aPos;
cur.X = this.__startP.x;
cur.Y = this.__startP.y;
cur.P = this.__startP.p;
}
Action.handler( e, this.__startaP );
this.__leaveMesg = Action.getMessage();
Action.dispose();
cur.unsuppressEvent();
this.__selStart = cur.PStart;
return true;
}
else
{
var prevPos = this.__start;
var newPos = cur.PStart;
@ -71,20 +100,9 @@
this.__selStart = prevPos;
}
if( Action )
{
cur.suppressEvent();
Action.handler( e, this.__startaP );
this.__leaveMesg = Action.getMessage();
Action.dispose();
cur.unsuppressEvent();
this.__selStart = cur.PStart;
return true;
}
cur.PStart = prevPos;
cur.PEnd = newPos;
}
};
VISUAL.prototype.getMessage = function()

View File

@ -26,6 +26,8 @@
var U = 85; var V = 86; var W = 87; var X = 88; var Y = 89;
var Z = 90;
var S_BRACKET_L = 219; var S_BRACKET_R = 221;
var ESC = 27;
var F1 = 112; var F2 = 113; var F3 = 114; var F4 = 115; var F5 = 116;
@ -184,6 +186,9 @@
case CTRL + R: // Redo
ccur.openRunAction( "REDO", e );
break;
case D: // Del with motion
ccur.openAction( "DELETE" );
break;
case X: // Del
break;
case SHIFT + X: // Delete before
@ -277,6 +282,33 @@
case SHIFT + _5: // %, Find next item
break;
case T: // To
break;
case I: // In between boundary
if( !ccur.action )
{
cursorHandled = false;
break;
}
this.__cMovement = true;
// Word boundary
this.__comp( kCode, function(){
debug.Info( "Word boundary" );
}, W );
this.__comp( kCode, function(){
debug.Info( "Bracket boundary [" );
}, S_BRACKET_L );
this.__comp( kCode, function(){
debug.Info( "Bracket boundary ]" );
}, S_BRACKET_R );
this.__comp( kCode, function(){
debug.Info( "Bracket boundary {" );
}, SHIFT + S_BRACKET_L );
this.__comp( kCode, function(){
debug.Info( "Bracket boundary }" );
}, SHIFT + S_BRACKET_R );
break;
case G: // Go to top
this.__cMovement = true;