Index: trunk/parsers/wikidom/lib/es/es.TextFlow.js |
— | — | @@ -231,9 +231,11 @@ |
232 | 232 | */ |
233 | 233 | TextFlow.prototype.renderIteration = function() { |
234 | 234 | var rs = this.renderState, |
235 | | - iteration = 0; |
| 235 | + iteration = 0, |
| 236 | + fractional = false; |
236 | 237 | while ( ++iteration <= rs.iterationLimit && rs.wordOffset < rs.wordCount - 1 ) { |
237 | 238 | rs.wordFit = this.fitWords( rs.wordOffset, rs.wordCount - 1, rs.ruler, rs.width ); |
| 239 | + fractional = false; |
238 | 240 | if ( rs.wordFit.width > rs.width ) { |
239 | 241 | // The first word didn't fit, we need to split it up |
240 | 242 | rs.charOffset = rs.lineStart; |
— | — | @@ -252,14 +254,16 @@ |
253 | 255 | rs.charFit.end = rs.lineEnd = this.boundaries[rs.wordOffset]; |
254 | 256 | } |
255 | 257 | } |
256 | | - this.appendLine( rs.charOffset, rs.charFit.end, rs.wordOffset, true ); |
| 258 | + this.appendLine( rs.charOffset, rs.charFit.end, rs.wordOffset, fractional ); |
257 | 259 | // Move on to another line |
258 | 260 | rs.charOffset = rs.charFit.end; |
| 261 | + // Mark the next line as fractional |
| 262 | + fractional = true; |
259 | 263 | } while ( rs.charOffset < rs.lineEnd ); |
260 | 264 | } else { |
261 | 265 | rs.wordOffset = rs.wordFit.end; |
262 | 266 | rs.lineEnd = this.boundaries[rs.wordOffset]; |
263 | | - this.appendLine( rs.lineStart, rs.lineEnd, rs.wordOffset, false ); |
| 267 | + this.appendLine( rs.lineStart, rs.lineEnd, rs.wordOffset, fractional ); |
264 | 268 | } |
265 | 269 | rs.lineStart = rs.lineEnd; |
266 | 270 | } |
— | — | @@ -348,8 +352,10 @@ |
349 | 353 | * |
350 | 354 | * @param start {Integer} Beginning of text range for line |
351 | 355 | * @param end {Integer} Ending of text range for line |
| 356 | + * @param wordOffset {Integer} Index within this.words which the line begins with |
| 357 | + * @param fractional {Boolean} If the line begins in the middle of a word |
352 | 358 | */ |
353 | | -TextFlow.prototype.appendLine = function( start, end, word, fractional ) { |
| 359 | +TextFlow.prototype.appendLine = function( start, end, wordOffset, fractional ) { |
354 | 360 | $line = this.$.find( '.editSurface-line[line-index=' + this.lines.length + ']' ); |
355 | 361 | if ( !$line.length ) { |
356 | 362 | $line = $( '<div class="editSurface-line" line-index="' + this.lines.length + '"></div>' ) |
— | — | @@ -363,7 +369,7 @@ |
364 | 370 | 'end': end, |
365 | 371 | 'width': $line.outerWidth(), |
366 | 372 | 'height': $line.outerHeight(), |
367 | | - 'word': word, |
| 373 | + 'word': wordOffset, |
368 | 374 | 'fractional': fractional |
369 | 375 | }); |
370 | 376 | // Disable links within content |