r91921 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91920‎ | r91921 | r91922 >
Date:23:17, 11 July 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Fixed remaining flow issues.
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.TextFlow.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.TextFlow.js
@@ -10,7 +10,7 @@
1111 this.boundaries = [];
1212 this.lines = [];
1313 this.width = null;
14 - this.boundaryTest = /([ \.\,\;\:\-\t\r\n\f])/g;
 14+ this.boundaryTest = /([ \-\t\r\n\f])/g;
1515 }
1616
1717 /**
@@ -188,15 +188,12 @@
189189 this.boundaryTest.lastIndex = 0;
190190 // Iterate over each word+boundary sequence, capturing offsets and encoding text as we go
191191 var match,
192 - start = 0,
193192 end;
194193 while ( match = this.boundaryTest.exec( text ) ) {
195194 // Include the boundary character in the range
196195 end = match.index + 1;
197196 // Store the boundary offset
198197 this.boundaries.push( end );
199 - // Remember the previous match
200 - start = end;
201198 }
202199 // If the last character is not a boundary character, we need to append the final range to the
203200 // "boundaries" and "words" arrays
@@ -250,10 +247,10 @@
251248 wordFit,
252249 charOffset,
253250 charFit,
254 - length = this.content.getLength(),
 251+ wordCount = this.boundaries.length,
255252 ruler = $ruler.addClass('editSurface-line')[0];
256 - while ( wordOffset < this.boundaries.length ) {
257 - wordFit = this.fitWords( wordOffset, length, ruler, width );
 253+ while ( wordOffset < wordCount - 1 ) {
 254+ wordFit = this.fitWords( wordOffset, wordCount - 1, ruler, width );
258255 if ( wordFit.width > width ) {
259256 // The first word didn't fit, we need to split it up
260257 charOffset = lineStart;
@@ -265,7 +262,7 @@
266263 if (charFit.end === lineEnd) {
267264 // Try to fit more words on the line
268265 wordFit = this.fitWords(
269 - wordOffset, length, ruler, width - charFit.width
 266+ wordOffset, wordCount - 1, ruler, width - charFit.width
270267 );
271268 if ( wordFit.end > wordOffset ) {
272269 wordOffset = wordFit.end;

Status & tagging log