This commit is contained in:
2016-03-15 05:22:37 +08:00
parent ee26a7dcc8
commit b7c693be07
11 changed files with 193 additions and 24 deletions

View File

@@ -19,9 +19,7 @@
INSERT.prototype.handler = function( e )
{
e.preventDefault();
if( e.key.length == "1" )
{
}
var inputChar = e.key;
};
INSERT.prototype.getMessage = function()

View File

@@ -5,19 +5,29 @@
var Controls = function( sender, e )
{
// Action Mode handled by the actions themselves
var cfeeder = sender.contentFeeder;
if( cfeeder.cursor.action )
{
cfeeder.cursor.action.handler( e );
return;
}
// Neve capture these keys
if( e.altKey
// F2 - F12
|| ( 112 < e.keyCode && e.keyCode < 124 )
) return;
// Action Mode handled by the actions themselves
var cfeeder = sender.contentFeeder;
if( cfeeder.cursor.action )
{
// Esc OR Ctrl+c
if( e.keyCode == 27 || ( e.ctrlKey && e.keyCode == 67 ) )
{
e.preventDefault();
cfeeder.cursor.closeAction();
}
else
{
cfeeder.cursor.action.handler( e );
}
return;
}
e.preventDefault();
if( e.ctrlKey )
@@ -50,7 +60,7 @@
// Insert
case 65: // a
cfeeder.cursor.openInsert();
cfeeder.cursor.openAction( "INSERT" );
break;
case 1065: // A, append at the line end

View File

@@ -71,7 +71,6 @@
// The resulting position
this.P = 0;
/** @type {Components.Vim.IAction} */
this.action = null;
};
@@ -207,13 +206,21 @@
this.updatePosition();
};
Cursor.prototype.openInsert = function()
Cursor.prototype.openAction = function( name )
{
var feeder = this.feeder;
if( this.action ) this.action.dispose();
this.action = new (Actions[ "INSERT" ])( this );
this.action = new (Actions[ name ])( this );
feeder.dispatcher.dispatchEvent( new BotanEvent( "VisualUpdate" ) );
this.feeder.dispatcher.dispatchEvent( new BotanEvent( "VisualUpdate" ) );
};
Cursor.prototype.closeAction = function()
{
if( !this.action ) return;
this.action.dispose();
this.action = null;
this.feeder.dispatcher.dispatchEvent( new BotanEvent( "VisualUpdate" ) );
};
Cursor.prototype.getLine = function()

View File

@@ -49,9 +49,6 @@
this.rows = element.rows;
this.cols = element.cols;
this.PosX = 1;
this.PosY = 1;
this.__active = false;
var _self = this;
@@ -64,10 +61,6 @@
this.VisualizeVimFrame( element.value );
};
VimArea.prototype.startInput = function( mode )
{
};
VimArea.prototype.select = function( sel )
{
if( !this.__active ) return;