All pastes #2092358 Raw Edit

Mine

public javascript v1 · immutable
#2092358 ·published 2011-10-21 23:19 UTC
rendered paste body
	} else if ( direction === 'up' || direction === 'down' ) {				/*		 * Looks for the in-document character position that would match up with the same horizontal		 * position - jumping a few pixels up/down at a time until we reach the next/previous line		 */		var oldPosition = this.documentView.getRenderedPosition( this.cursor.offset );		if ( this.cursor.initialLeft === null ) {			this.cursor.initialLeft = oldPosition.left;		}		var	fakePosition = new es.Position( this.cursor.initialLeft, oldPosition.top ),			i = 1,			offset,			step,			edge;		if ( direction === 'up' ) {			step = -5;			edge = 0;		} else {			step = 5;			edge = this.documentView.getLength();		}				do {			fakePosition.top += i++ * step;			offset = this.documentView.getOffsetFromPosition( fakePosition );			fakePosition = this.documentView.getRenderedPosition( offset );			fakePosition.left = this.cursor.initialLeft;		} while ( oldPosition.top === fakePosition.top && offset !== edge );		this.showCursor( this.documentView.getOffsetFromPosition( fakePosition ) );	}	} else if ( direction === 'up' || direction === 'down' ) {				/*		 * Looks for the in-document character position that would match up with the same horizontal		 * position - jumping a few pixels up/down at a time until we reach the next/previous line		 */		var oldPosition = this.documentView.getRenderedPosition( this.cursor.offset );		if ( this.cursor.initialLeft === null ) {			this.cursor.initialLeft = oldPosition.left;		}		var	fakePosition = new es.Position( this.cursor.initialLeft, oldPosition.top ),			i = 1,			offset,			step,			edge;		if ( direction === 'up' ) {			step = -5;			edge = 0;		} else {			step = 5;			edge = this.documentView.getLength();		}				do {			fakePosition.top += i++ * step;			offset = this.documentView.getOffsetFromPosition( fakePosition );			fakePosition = this.documentView.getRenderedPosition( offset );			fakePosition.left = this.cursor.initialLeft;		} while ( oldPosition.top === fakePosition.top && offset !== edge );		this.showCursor( this.documentView.getOffsetFromPosition( fakePosition ) );	}