r103606 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103605‎ | r103606 | r103607 >
Date:19:48, 18 November 2011
Author:inez
Status:deferred
Tags:
Comment:
Improve logic for moving cursor up and down - especially in case of initialBias.
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -571,7 +571,8 @@
572572 * reach the next/previous line
573573 */
574574 var position = this.documentView.getRenderedPositionFromOffset(
575 - this.selection.to
 575+ this.selection.to,
 576+ this.cursor.initialBias
576577 );
577578 if ( this.cursor.initialLeft === null ) {
578579 this.cursor.initialLeft = position.left;
@@ -588,7 +589,8 @@
589590 break;
590591 }
591592 fakePosition = this.documentView.getRenderedPositionFromOffset(
592 - this.documentView.getOffsetFromRenderedPosition( fakePosition )
 593+ this.documentView.getOffsetFromRenderedPosition( fakePosition ),
 594+ this.cursor.initialBias
593595 );
594596 fakePosition.left = this.cursor.initialLeft;
595597 } while ( position.top === fakePosition.top );
@@ -598,8 +600,13 @@
599601 break;
600602 }
601603
602 - this.cursor.initialBias = direction === 'right' && unit === 'line' ? true : false;
603 -
 604+ this.cursor.initialBias = (
 605+ ( direction === 'right' && unit === 'line' ) ||
 606+ ( direction === 'down' && unit === 'char' ) ||
 607+ ( direction === 'up' && unit === 'char' ) ) ?
 608+ true :
 609+ false;
 610+
604611 if ( this.keyboard.keys.shift && this.selection.from !== to) {
605612 this.selection.to = to;
606613 this.documentView.drawSelection( this.selection );

Status & tagging log