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(); e.preventDefault();
// TODO: Get the input for determinating registers var cput = this.__cursor.Vim.registers.get();
var inputStack = false;
var cput = this.__cursor.Vim.registers.get( inputStack );
if( !cput ) return true; if( !cput ) return true;
var clen = cput.length;
var nLines = occurence( cput, "\n" );
var cur = this.__cursor; var cur = this.__cursor;
var feeder = cur.feeder; var feeder = cur.feeder;
var newLine = cput.newLine; 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 // Compensation
var c = e.kMap( "P" ) ? 0 : -1; var c = e.kMap( "P" ) ? 0 : -1;

View File

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