Index: trunk/parsers/wikidom/lib/es/es.TextFlow.js |
— | — | @@ -22,16 +22,16 @@ |
23 | 23 | |
24 | 24 | // Events |
25 | 25 | var flow = this; |
26 | | - this.content.on( 'change', function() { |
| 26 | + this.content.on( 'insert', function( args ) { |
27 | 27 | flow.scanBoundaries(); |
28 | | - } ); |
29 | | - this.content.on( 'insert', function( args ) { |
30 | 28 | flow.render( args.offset ); |
31 | 29 | } ); |
32 | 30 | this.content.on( 'remove', function( args ) { |
| 31 | + flow.scanBoundaries(); |
33 | 32 | flow.render( args.start ); |
34 | 33 | } ); |
35 | 34 | this.content.on( 'annotate', function( args ) { |
| 35 | + flow.scanBoundaries(); |
36 | 36 | flow.render( args.start ); |
37 | 37 | } ); |
38 | 38 | |
— | — | @@ -239,6 +239,7 @@ |
240 | 240 | if ( rs.wordFit.width > rs.width ) { |
241 | 241 | // The first word didn't fit, we need to split it up |
242 | 242 | rs.charOffset = rs.lineStart; |
| 243 | + var lineOffset = rs.wordOffset; |
243 | 244 | rs.wordOffset++; |
244 | 245 | rs.lineEnd = this.boundaries[rs.wordOffset]; |
245 | 246 | do { |
— | — | @@ -250,20 +251,21 @@ |
251 | 252 | rs.wordOffset, rs.wordCount - 1, rs.ruler, rs.width - rs.charFit.width |
252 | 253 | ); |
253 | 254 | if ( rs.wordFit.end > rs.wordOffset ) { |
| 255 | + lineOffset = rs.wordOffset; |
254 | 256 | rs.wordOffset = rs.wordFit.end; |
255 | 257 | rs.charFit.end = rs.lineEnd = this.boundaries[rs.wordOffset]; |
256 | 258 | } |
257 | 259 | } |
258 | | - this.appendLine( rs.charOffset, rs.charFit.end, rs.wordOffset, fractional ); |
| 260 | + this.appendLine( rs.charOffset, rs.charFit.end, lineOffset, fractional ); |
259 | 261 | // Move on to another line |
260 | 262 | rs.charOffset = rs.charFit.end; |
261 | 263 | // Mark the next line as fractional |
262 | 264 | fractional = true; |
263 | 265 | } while ( rs.charOffset < rs.lineEnd ); |
264 | 266 | } else { |
| 267 | + rs.lineEnd = this.boundaries[rs.wordFit.end]; |
| 268 | + this.appendLine( rs.lineStart, rs.lineEnd, rs.wordOffset, fractional ); |
265 | 269 | rs.wordOffset = rs.wordFit.end; |
266 | | - rs.lineEnd = this.boundaries[rs.wordOffset]; |
267 | | - this.appendLine( rs.lineStart, rs.lineEnd, rs.wordOffset, fractional ); |
268 | 270 | } |
269 | 271 | rs.lineStart = rs.lineEnd; |
270 | 272 | } |
— | — | @@ -276,7 +278,6 @@ |
277 | 279 | .nextAll() |
278 | 280 | .remove(); |
279 | 281 | rs.timeout = undefined; |
280 | | - console.log( this.lines.length ); |
281 | 282 | this.emit( 'render' ); |
282 | 283 | } else { |
283 | 284 | rs.ruler.innerHTML = ''; |