forked from Botanical/BotanJS
FIND does not work properly due to 5311dc0
This commit is contained in:
parent
7624d2b2fb
commit
c9c5ff25af
@ -182,10 +182,13 @@
|
||||
startLine.aPos = startLine.aEnd;
|
||||
}
|
||||
}
|
||||
// Cursor position adjustment
|
||||
// this swap the cursor direction from LTR to RTL
|
||||
// i.e. treat all delete as "e<----s" flow
|
||||
// to keep the cursor position as the top on UNDO / REDO
|
||||
|
||||
/**
|
||||
* Content Modifier:
|
||||
* This swaps the cursor direction from LTR to RTL
|
||||
* i.e. treat all delete as "e<----s" flow to keep
|
||||
* the cursor position as the top on UNDO / REDO
|
||||
**/
|
||||
var IsContMod = ~[ DELETE, PUT ].indexOf( Action.constructor );
|
||||
if( IsContMod && startLine.aPos < cur.aPos )
|
||||
{
|
||||
@ -196,7 +199,12 @@
|
||||
|
||||
Action.handler( e, startLine.aPos, lineMode );
|
||||
|
||||
if( !IsContMod )
|
||||
/**
|
||||
* Cursor Modifier:
|
||||
* Whether the cursor position is already handled
|
||||
**/
|
||||
var IsCurMod = ~[ DELETE, PUT, SHIFT_LINES ].indexOf( Action.constructor );
|
||||
if( !IsCurMod )
|
||||
{
|
||||
cur.moveTo( startLine.aPos );
|
||||
}
|
||||
|
@ -136,6 +136,7 @@
|
||||
case ")": Mod = SHIFT; case "0": kCode = Mod + _0; break;
|
||||
case "<": Mod = SHIFT; case ",": kCode = Mod + COMMA; break;
|
||||
case ">": Mod = SHIFT; case ".": kCode = Mod + FULLSTOP; break;
|
||||
case "\"": Mod = SHIFT; case "'": kCode = Mod + QUOTE; break;
|
||||
|
||||
default:
|
||||
throw new Error( "Unsupport keys: " + str );
|
||||
@ -779,6 +780,30 @@
|
||||
this.__divedCCmd = new ExCommand( ccur, "/" );
|
||||
this.__divedCCmd.handler( e );
|
||||
break;
|
||||
|
||||
case SHIFT + SEMI_COLON: // ":", only happens within action
|
||||
if( !ccur.action )
|
||||
{
|
||||
cursorHandled = false;
|
||||
break;
|
||||
}
|
||||
|
||||
this.__cMovement = true;
|
||||
|
||||
var exCmd = new ExCommand( ccur, ":" );
|
||||
exCmd.handler( e );
|
||||
|
||||
// Auto define range '< and '>
|
||||
var cSel = ccur.position;
|
||||
if( 1 < ( cSel.end - cSel.start ) )
|
||||
{
|
||||
ActionEvent
|
||||
.__createEventList( e.sender, "'<,'>" )
|
||||
.forEach( function( e2 ) { exCmd.handler( e2 ); } );
|
||||
}
|
||||
|
||||
this.__divedCCmd = exCmd;
|
||||
break;
|
||||
default:
|
||||
cursorHandled = false;
|
||||
}
|
||||
@ -861,7 +886,10 @@
|
||||
{
|
||||
var SubCommand = !this.__compositeReg;
|
||||
this.__cursorCommand( e, kCode );
|
||||
if( SubCommand && this.__compositeReg )
|
||||
|
||||
// Check if Sub / Dived composite command has been initiated
|
||||
// within the CursorCommand
|
||||
if( ( SubCommand && this.__compositeReg ) || this.__divedCCmd )
|
||||
{
|
||||
e.preventDefault();
|
||||
return;
|
||||
@ -927,6 +955,18 @@
|
||||
this.__range = null;
|
||||
};
|
||||
|
||||
ActionEvent.__createEventList = function( sender, KeyDefs )
|
||||
{
|
||||
var l = KeyDefs.length;
|
||||
var List = [];
|
||||
for( var i = 0; i < l; i ++ )
|
||||
{
|
||||
List.push( new ActionEvent( sender, KeyDefs[ i ] ) );
|
||||
}
|
||||
|
||||
return List;
|
||||
};
|
||||
|
||||
__readOnly( ActionEvent.prototype, "target", function() { return this.__target; } );
|
||||
__readOnly( ActionEvent.prototype, "key", function() { return this.__key; } );
|
||||
__readOnly( ActionEvent.prototype, "keyCode", function() { return this.__kCode; } );
|
||||
|
@ -134,14 +134,18 @@
|
||||
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();
|
||||
|
||||
// Because moveTo is a direct jump function
|
||||
// We'll have to auto reveal the target line here
|
||||
if( pline.lineNum != expLineNum )
|
||||
{
|
||||
this.moveY( expLineNum - pline.lineNum );
|
||||
pline = this.getLine();
|
||||
}
|
||||
|
||||
var jumpX = aPos < lineStart ? lineStart - aPos : aPos - lineStart;
|
||||
var kX = jumpX - pline.content.length;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user