Bug fix for count movement

This commit is contained in:
斟酌 鵬兄 2016-04-16 22:33:02 +08:00
parent 450a7d578c
commit 3c2cb66c8f
2 changed files with 30 additions and 9 deletions

View File

@ -28,8 +28,8 @@
this.__slineNum = Cursor.getLine().lineNum; this.__slineNum = Cursor.getLine().lineNum;
this.__lines = e.count; this.__lines = e.count - 1;
debug.Info( "Open shift: " + this.__lines + " line(s) below the cursor" ); debug.Info( "Open shift: " + this.__lines + " line(s) from the cursor" );
this.__direction = e.kMap( ">" ) ? 1 : -1; this.__direction = e.kMap( ">" ) ? 1 : -1;
debug.Info( "Direction is: " + ( this.__direction == 1 ? ">" : "<" ) ); debug.Info( "Direction is: " + ( this.__direction == 1 ? ">" : "<" ) );
@ -62,7 +62,7 @@
if( 1 < e.count ) if( 1 < e.count )
{ {
nline += e.count; nline += ( e.count - 1 );
} }
// default: >>, <<, >l, <h // default: >>, <<, >l, <h
@ -79,6 +79,21 @@
if( this.__startX != currAp ) if( this.__startX != currAp )
{ {
start = 0; end = 0;
if( nline )
{
if( currAp < sp )
{
start -= ( nline - 1 );
}
else
{
end += ( nline - 1 );
}
console.log( start, end );
}
if( currAp < sp ) if( currAp < sp )
{ {
sp = sp + currAp; sp = sp + currAp;
@ -86,7 +101,6 @@
sp = sp - currAp; sp = sp - currAp;
} }
start = end = 0;
for( var i = 0; i < currAp; i ++ ) for( var i = 0; i < currAp; i ++ )
{ {
if( feeder.content[ i ] == "\n" ) if( feeder.content[ i ] == "\n" )

View File

@ -407,7 +407,13 @@
_self.__mod = false; _self.__mod = false;
}, ANY_KEY ); }, ANY_KEY );
break; break;
case _0: case _1: case _2: case _3: case _4: case _0: // No 0 for first count
if( !this.__compositeReg )
{
mod = false;
break;
}
case _1: case _2: case _3: case _4:
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;
@ -470,11 +476,12 @@
switch( kCode ) switch( kCode )
{ {
case BACKSPACE: this.__cMoveX( -1, true ); break; // Backspace, go back 1 char case BACKSPACE: this.__cMoveX( -1, true ); break; // Backspace, go back 1 char
case H: this.__cMoveX( -1 ); break; // Left case H: this.__cMoveX( - e.count ); break; // Left
case L: this.__cMoveX( 1 ); break; // Right case L: this.__cMoveX( e.count ); break; // Right
case K: this.__cMoveY( -1 ); break; // Up case DASH: case GECKO_DASH:
case K: this.__cMoveY( - e.count ); break; // Up
case ENTER: case ENTER:
case J: this.__cMoveY( 1 ); break; // Down case J: this.__cMoveY( e.count ); break; // Down
case CTRL + F: // Page Down case CTRL + F: // Page Down
if( cfeeder.firstBuffer.nextLine.placeholder ) if( cfeeder.firstBuffer.nextLine.placeholder )