PUT can now select registers

This commit is contained in:
斟酌 鵬兄 2016-04-07 23:56:09 +08:00
parent 6f7a1cc92c
commit a3fa2e82d7
2 changed files with 38 additions and 20 deletions

View File

@ -29,20 +29,29 @@
{
e.preventDefault();
// TODO: Get the input for determinating registers
var inputStack = false;
var cput = this.__cursor.Vim.registers.get( inputStack );
var cput = this.__cursor.Vim.registers.get();
if( !cput ) return true;
var clen = cput.length;
var nLines = occurence( cput, "\n" );
var cur = this.__cursor;
var feeder = cur.feeder;
var newLine = cput.newLine;
if( 1 < e.count )
{
var oput = cput;
for( var i = 1; i < e.count; i ++ )
{
oput += cput;
}
cput = oput;
oput = null;
}
var nLines = occurence( cput, "\n" );
var clen = cput.length;
// Compensation
var c = e.kMap( "P" ) ? 0 : -1;

View File

@ -322,12 +322,11 @@
Controls.prototype.__modCommand = function( e )
{
var catchCommand = false;
if( this.__mod )
{
e.preventDefault();
this.__composite( e );
return catchCommand;
return;
}
var _self = this;
@ -339,6 +338,8 @@
case SHIFT + QUOTE:
this.__composite( e, function( e2 ) {
e2.target.registers.select( e2.key );
e2.cancel();
_self.__mod = false;
}, ANY_KEY );
break;
@ -346,19 +347,21 @@
case _5: case _6: case _7: case _8: case _9:
var Count = e.key;
var recurNum = function( e2 ) {
switch( e2.keyCode )
var recurNum = function( e )
{
switch( e.keyCode )
{
case _0: case _1: case _2:
case _3: case _4: case _5:
case _6: case _7: case _8: case _9:
Count += e2.key;
_self.__composite( e2, recurNum, ANY_KEY );
Count += e.key;
_self.__composite( e, recurNum, ANY_KEY );
e.cancel();
return;
}
e.__count = Number( Count );
debug.Info( "Count is: " + Count );
catchCommand = true;
_self.__mod = false;
};
@ -369,9 +372,10 @@
}
this.__mod = mod;
if( mod ) e.preventDefault();
return mod;
if( mod )
{
e.cancel();
}
};
Controls.prototype.__cursorCommand = function( e )
@ -622,7 +626,8 @@
if( e.canceled ) return;
}
if( this.__modCommand( e ) ) return;
this.__modCommand( e );
if( e.canceled ) return;
var cfeeder = this.__cfeeder;
var ccur = this.__ccur;
@ -702,8 +707,6 @@
this.__range = null;
};
ActionEvent.prototype.cancel = function() { this.__canceled = true; };
__readOnly( ActionEvent.prototype, "target", function() { return this.__target; } );
__readOnly( ActionEvent.prototype, "key", function() { return this.__key; } );
__readOnly( ActionEvent.prototype, "keyCode", function() { return this.__kCode; } );
@ -733,6 +736,12 @@
return this.__kCode == Map( map );
};
ActionEvent.prototype.cancel = function()
{
this.preventDefault();
this.__canceled = true;
};
ActionEvent.prototype.preventDefault = function()
{
if( this.__e ) this.__e.preventDefault();