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

View File

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