forked from Botanical/BotanJS
		
	fixed DEL the end resulting wrong pos
This commit is contained in:
		| @@ -164,12 +164,6 @@ | ||||
| 		var stator = new Stator( cur, s ); | ||||
| 		var stack = new Stack(); | ||||
|  | ||||
| 		c = c[ e + 1 ]; | ||||
| 		if( c == "\n" || c == undefined ) | ||||
| 		{ | ||||
| 			cur.moveX( -1 ); | ||||
| 		} | ||||
|  | ||||
| 		var f = stator.save( 0, removed ); | ||||
| 		stack.store( function() { | ||||
| 			f(); | ||||
|   | ||||
| @@ -33,12 +33,19 @@ | ||||
|  | ||||
| 		// Initialize this stack | ||||
| 		this.__rec( "", true ); | ||||
|  | ||||
| 		var l = this.__cursor.feeder.firstBuffer.cols; | ||||
| 		var msg = Mesg( "INSERT" ); | ||||
|  | ||||
| 		for( var i = msg.length; i < l; i ++ ) msg += " "; | ||||
| 		this.__msg = msg; | ||||
| 	}; | ||||
|  | ||||
| 	INSERT.prototype.allowMovement = false; | ||||
|  | ||||
| 	INSERT.prototype.dispose = function() | ||||
| 	{ | ||||
| 		this.__msg = ""; | ||||
| 		this.__rec( "", true ); | ||||
| 		this.__cursor.moveX( -1 ); | ||||
| 	}; | ||||
| @@ -158,11 +165,7 @@ | ||||
|  | ||||
| 	INSERT.prototype.getMessage = function() | ||||
| 	{ | ||||
| 		var l = this.__cursor.feeder.firstBuffer.cols; | ||||
| 		var msg = Mesg( "INSERT" ); | ||||
|  | ||||
| 		for( var i = msg.length; i < l; i ++ ) msg += " "; | ||||
| 		return msg; | ||||
| 		return this.__msg; | ||||
| 	}; | ||||
|  | ||||
| 	ns[ NS_EXPORT ]( EX_CLASS, "INSERT", INSERT ); | ||||
|   | ||||
| @@ -179,7 +179,7 @@ | ||||
| 			case SHIFT + A: // Append at the line end | ||||
| 				ccur.lineEnd(); | ||||
| 			case A: // Append | ||||
| 				this.__cMoveX( 1, true, true ); | ||||
| 				ccur.moveX( 1, true, true ); | ||||
| 			case I: // Insert | ||||
| 				ccur.openAction( "INSERT" ); | ||||
| 				break; | ||||
|   | ||||
| @@ -124,6 +124,8 @@ | ||||
| 		jumpX += Math.ceil( jumpX / pline.cols ) - 1; | ||||
|  | ||||
| 		if( jumpY ) this.moveY( jumpY ); | ||||
|  | ||||
| 		// This needed because first line does not contain first "\n" character | ||||
| 		if( 0 < this.getLine().lineNum && lineStart <= aPos ) jumpX --; | ||||
|  | ||||
| 		this.moveX( - Number.MAX_VALUE ); | ||||
| @@ -135,13 +137,14 @@ | ||||
| 	Cursor.prototype.moveX = function( d, penetrate, phantomSpace ) | ||||
| 	{ | ||||
| 		var x = this.pX; | ||||
| 		var updatePx = Boolean( d ); | ||||
|  | ||||
| 		if( 0 < this.__off ) | ||||
| 		{ | ||||
| 			d += this.__off; | ||||
| 			this.__off = 0; | ||||
| 		} | ||||
|  | ||||
| 		var updatePx = Boolean( d ); | ||||
| 		if( updatePx ) x = this.X + d; | ||||
|  | ||||
| 		if( !d ) d = 1; | ||||
| @@ -368,6 +371,9 @@ | ||||
| 	Cursor.prototype.openAction = function( name ) | ||||
| 	{ | ||||
| 		if( this.action ) this.action.dispose(); | ||||
|  | ||||
| 		debug.Info( "openAction: " + name ); | ||||
|  | ||||
| 		this.action = new (Actions[ name ])( this ); | ||||
| 		this.__pulseMsg = null; | ||||
|  | ||||
| @@ -381,6 +387,8 @@ | ||||
| 		this.__pulseMsg = this.action.getMessage(); | ||||
| 		this.action = null; | ||||
|  | ||||
| 		debug.Info( "closeAction" ); | ||||
|  | ||||
| 		// Reset the analyzed content | ||||
| 		this.Vim.contentAnalyzer.reset(); | ||||
|  | ||||
|   | ||||
| @@ -249,15 +249,18 @@ | ||||
|  | ||||
| 		} | ||||
|  | ||||
| 		var tMatch = SetParent( tokPairs, highest ); | ||||
| 		var oMatch = tMatch; | ||||
| 		if( highest ) | ||||
| 		{ | ||||
| 			var tMatch = SetParent( tokPairs, highest ); | ||||
| 			var oMatch = tMatch; | ||||
|  | ||||
| 		do { | ||||
| 			oMatch.__open ++; | ||||
| 			oMatch.__close --; | ||||
| 		} while( oMatch = oMatch.parent ) | ||||
| 			do { | ||||
| 				oMatch.__open ++; | ||||
| 				oMatch.__close --; | ||||
| 			} while( oMatch = oMatch.parent ) | ||||
|  | ||||
| 		if( highest ) return tMatch; | ||||
| 			return tMatch; | ||||
| 		} | ||||
|  | ||||
| 		return new TokenMatch(); | ||||
| 	}; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user