r92666 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92665‎ | r92666 | r92667 >
Date:19:11, 20 July 2011
Author:inez
Status:deferred
Tags:
Comment:
Fix handling for delete and backspace
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.Surface.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.Surface.js
@@ -232,8 +232,9 @@
233233 var deleteSelection = new es.Selection(
234234 new es.Location( this.location.block, this.location.offset - 1 ), this.location
235235 );
 236+ deleteSelection.normalize();
236237 this.selection = new es.Selection();
237 - this.location = deleteSelection.from;
 238+ this.location = deleteSelection.start;
238239 this.deleteContent( deleteSelection );
239240 }
240241 };
@@ -242,18 +243,17 @@
243244 if ( this.selection.from && this.selection.to ) {
244245 var deleteSelection = this.selection;
245246 deleteSelection.normalize();
246 - this.location = this.selection.end;
 247+ this.location = this.selection.start;
247248 this.selection = new es.Selection();
248249 this.deleteContent( deleteSelection );
249 - this.location.offset -= deleteSelection.to.offset - deleteSelection.from.offset;
250250 } else if ( this.location.offset < this.location.block.getLength() - 1 ) {
251251 var deleteSelection = new es.Selection(
252252 new es.Location( this.location.block, this.location.offset + 1 ), this.location
253253 );
 254+ deleteSelection.normalize();
254255 this.selection = new es.Selection();
255 - this.location = deleteSelection.from;
 256+ this.location = deleteSelection.start;
256257 this.deleteContent( deleteSelection );
257 - this.location.offset--;
258258 }
259259 };
260260

Status & tagging log