Index: trunk/parsers/wikidom/lib/es/es.ParagraphBlock.js |
— | — | @@ -12,6 +12,10 @@ |
13 | 13 | this.updateText(); |
14 | 14 | } |
15 | 15 | |
| 16 | +Block.prototype.getLength = function() { |
| 17 | + return this.flow.length; |
| 18 | +}; |
| 19 | + |
16 | 20 | /** |
17 | 21 | * Update text given to the flow object |
18 | 22 | */ |
Index: trunk/parsers/wikidom/lib/es/es.Surface.js |
— | — | @@ -221,10 +221,10 @@ |
222 | 222 | */ |
223 | 223 | Surface.prototype.moveCursorRight = function() { |
224 | 224 | var location = this.getCursor(); |
225 | | - if ( 1 || location.block.length > location.offset + 1 ) { |
| 225 | + if ( location.block.getLength() > location.offset + 1 ) { |
226 | 226 | location.offset++; |
227 | 227 | } else { |
228 | | - var next = location.block.next(); |
| 228 | + var next = location.block.nextBlock(); |
229 | 229 | if ( next ) { |
230 | 230 | location.block = next; |
231 | 231 | location.offset = 0; |
— | — | @@ -241,10 +241,10 @@ |
242 | 242 | if ( location.offset > 0 ) { |
243 | 243 | location.offset--; |
244 | 244 | } else { |
245 | | - var previous = location.block.previous(); |
| 245 | + var previous = location.block.previousBlock(); |
246 | 246 | if ( previous ) { |
247 | 247 | location.block = previous; |
248 | | - location.offset = location.block.length - 1; |
| 248 | + location.offset = location.block.getLength() - 1; |
249 | 249 | } |
250 | 250 | } |
251 | 251 | this.setCursor( location ); |
Index: trunk/parsers/wikidom/lib/es/es.Block.js |
— | — | @@ -6,6 +6,10 @@ |
7 | 7 | this.document = null; |
8 | 8 | } |
9 | 9 | |
| 10 | +Block.prototype.getLength = function() { |
| 11 | + throw 'Block.getLength not implemented in this subclass.'; |
| 12 | +}; |
| 13 | + |
10 | 14 | /** |
11 | 15 | * Gets the index of the block within it's document. |
12 | 16 | * |
— | — | @@ -28,7 +32,7 @@ |
29 | 33 | throw 'Missing document error. Block is not attached to a document.'; |
30 | 34 | } |
31 | 35 | var index = this.index() + 1; |
32 | | - return this.document.blocks.length < index ? this.document.blocks[index] : null; |
| 36 | + return this.document.blocks.length > index ? this.document.blocks[index] : null; |
33 | 37 | }; |
34 | 38 | |
35 | 39 | /** |
Index: trunk/parsers/wikidom/lib/es/es.TextFlow.js |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | */ |
8 | 8 | function TextFlow( $container, text ) { |
9 | 9 | this.$ = $container; |
| 10 | + this.length = 0; |
10 | 11 | this.boundaries = []; |
11 | 12 | this.words = []; |
12 | 13 | this.lines = []; |
— | — | @@ -206,8 +207,10 @@ |
207 | 208 | this.boundaries.push( text.length ); |
208 | 209 | this.words.push( this.escape( text.substring( end, text.length ) ) ); |
209 | 210 | } |
| 211 | + this.length = text.length; |
210 | 212 | // Force re-flow |
211 | 213 | this.width = null; |
| 214 | + |
212 | 215 | }; |
213 | 216 | |
214 | 217 | /** |