forked from Botanical/BotanJS
		
	wordwrap panning for k
This commit is contained in:
		@@ -135,13 +135,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	Cursor.prototype.moveY = function( d )
 | 
						Cursor.prototype.moveY = function( d )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		var Y = this.Y;
 | 
							var Y = this.Y + d;
 | 
				
			||||||
		var line;
 | 
							var line;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Y += d;
 | 
					 | 
				
			||||||
		if( Y < 0 )
 | 
							if( Y < 0 )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Y = 0;
 | 
								this.feeder.pan( undefined, d );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								this.Y = 0;
 | 
				
			||||||
 | 
								this.moveX();
 | 
				
			||||||
 | 
								this.updatePosition();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								this.feeder.softReset();
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if( this.feeder.moreAt < Y )
 | 
							else if( this.feeder.moreAt < Y )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -186,7 +192,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if ( this.Y < Y )
 | 
							else if ( 0 < d )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			// If panning is forward
 | 
								// If panning is forward
 | 
				
			||||||
			// and next line does not exists
 | 
								// and next line does not exists
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,6 +130,7 @@
 | 
				
			|||||||
		return this.__render( buffs[ start ], this.__rLength );
 | 
							return this.__render( buffs[ start ], this.__rLength );
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Performs a line panning
 | 
				
			||||||
	Feeder.prototype.pan = function( dX, dY )
 | 
						Feeder.prototype.pan = function( dX, dY )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if( dX == undefined ) dX = 0;
 | 
							if( dX == undefined ) dX = 0;
 | 
				
			||||||
@@ -140,13 +141,19 @@
 | 
				
			|||||||
		var X = this.panX + dX;
 | 
							var X = this.panX + dX;
 | 
				
			||||||
		var Y = this.panY + dY;
 | 
							var Y = this.panY + dY;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		var f = this.content.indexOf( "\n" );
 | 
							var f = -1;
 | 
				
			||||||
		var i = 1;
 | 
							var i = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		while( f != - 1 && i < Y )
 | 
							// Y cannot be negative
 | 
				
			||||||
 | 
							if( Y < 0 ) Y = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if( 0 < Y )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			i ++;
 | 
								f = this.content.indexOf( "\n" );
 | 
				
			||||||
			f = this.content.indexOf( "\n", f + 1 );
 | 
								for( i = 1; f != - 1 && i < Y; i ++ )
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									f = this.content.indexOf( "\n", f + 1 );
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.firstBuffer.Push(
 | 
							this.firstBuffer.Push(
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user