forked from Botanical/BotanJS
Merge remote-tracking branch 'vim/master' into Astro
This commit is contained in:
commit
6070731899
@ -121,6 +121,7 @@
|
|||||||
cur.moveY( -1 );
|
cur.moveY( -1 );
|
||||||
cur.lineStart();
|
cur.lineStart();
|
||||||
}
|
}
|
||||||
|
// Remove to Cursor jumps
|
||||||
else if( this.__startX < currAp )
|
else if( this.__startX < currAp )
|
||||||
{
|
{
|
||||||
// Swap the movement
|
// Swap the movement
|
||||||
@ -128,6 +129,10 @@
|
|||||||
// position to the earlier position
|
// position to the earlier position
|
||||||
sp = currAp;
|
sp = currAp;
|
||||||
cur.moveTo( this.__startX );
|
cur.moveTo( this.__startX );
|
||||||
|
|
||||||
|
// Special case for cw dn cursor jumps that
|
||||||
|
// does not remove the start position
|
||||||
|
if( e.kMap( "w" ) || e.kMap( "n" ) ) sp --;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remove the current line
|
// Remove the current line
|
||||||
|
@ -102,6 +102,8 @@
|
|||||||
var r;
|
var r;
|
||||||
var Hit;
|
var Hit;
|
||||||
var FirstHit;
|
var FirstHit;
|
||||||
|
|
||||||
|
var l = 0;
|
||||||
var PrevStack = [];
|
var PrevStack = [];
|
||||||
|
|
||||||
var LoopGuard;
|
var LoopGuard;
|
||||||
@ -125,6 +127,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
PrevStack.push( r.index );
|
PrevStack.push( r.index );
|
||||||
|
l ++;
|
||||||
LoopGuard = r.index;
|
LoopGuard = r.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,11 +135,19 @@
|
|||||||
|
|
||||||
if( e.kMap( "N" ) )
|
if( e.kMap( "N" ) )
|
||||||
{
|
{
|
||||||
Hit = PrevStack[ PrevStack.length - 2 ];
|
// The search loop above always search for next match
|
||||||
|
// So use the previous match
|
||||||
|
Hit = PrevStack[ l - 1 ];
|
||||||
|
|
||||||
|
// Adjust if cursor is already in the previous match
|
||||||
|
if( Hit == p ) Hit = PrevStack[ l - 2 ];
|
||||||
|
|
||||||
if( Hit == undefined )
|
if( Hit == undefined )
|
||||||
{
|
{
|
||||||
this.__msg = Mesg( "SEARCH_HIT_TOP" );
|
this.__msg = Mesg( "SEARCH_HIT_TOP" );
|
||||||
|
|
||||||
|
// This resets the exec state in previous loop
|
||||||
|
search = new RegExp( search );
|
||||||
while( ( r = search.exec( content ) ) !== null ) Hit = r.index;
|
while( ( r = search.exec( content ) ) !== null ) Hit = r.index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,9 +131,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var jumpY = expLineNum - lastLineNum;
|
var jumpY = expLineNum - lastLineNum;
|
||||||
var jumpX = aPos < lineStart ? lineStart - aPos : aPos - lineStart;
|
if( jumpY )
|
||||||
|
{
|
||||||
|
this.moveY( jumpY );
|
||||||
|
|
||||||
|
// Because moveTo is a direct jump function
|
||||||
|
// We'll auto reveal the target line here
|
||||||
|
if( this.feeder.moreAt == this.Y ) this.moveY( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
pline = this.getLine();
|
||||||
|
|
||||||
|
var jumpX = aPos < lineStart ? lineStart - aPos : aPos - lineStart;
|
||||||
var kX = jumpX - pline.content.length;
|
var kX = jumpX - pline.content.length;
|
||||||
|
|
||||||
|
// This handles word-wrapped long line phantom "\n"
|
||||||
while( 0 < kX )
|
while( 0 < kX )
|
||||||
{
|
{
|
||||||
jumpX ++;
|
jumpX ++;
|
||||||
@ -142,8 +154,6 @@
|
|||||||
kX -= pline.content.length;
|
kX -= pline.content.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( jumpY ) this.moveY( jumpY );
|
|
||||||
|
|
||||||
// This is needed because first line does not contain the first "\n" character
|
// This is needed because first line does not contain the first "\n" character
|
||||||
if( 0 < this.getLine().lineNum && lineStart <= aPos ) jumpX --;
|
if( 0 < this.getLine().lineNum && lineStart <= aPos ) jumpX --;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
var VIMRE_VERSION = "1.0.1";
|
var VIMRE_VERSION = "1.0.2";
|
||||||
(function(){
|
(function(){
|
||||||
var ns = __namespace( "Components.Vim" );
|
var ns = __namespace( "Components.Vim" );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user