Index: trunk/parsers/wikidom/lib/es/es.TextFlow.js |
— | — | @@ -119,14 +119,14 @@ |
120 | 120 | * positions, which is a nice benefit of this method. |
121 | 121 | */ |
122 | 122 | while ( line < lineCount ) { |
123 | | - if ( offset >= lines[line].start && offset < lines[line].end ) { |
124 | | - position.bottom = position.top + lines[line].height; |
| 123 | + if ( offset >= this.lines[line].start && offset < this.lines[line].end ) { |
| 124 | + position.bottom = position.top + this.lines[line].height; |
125 | 125 | break; |
126 | 126 | } |
127 | | - position.top += lines[line].height; |
| 127 | + position.top += this.lines[line].height; |
128 | 128 | line++; |
129 | 129 | }; |
130 | | - |
| 130 | + |
131 | 131 | /* |
132 | 132 | * Virtual n+1 position |
133 | 133 | * |
— | — | @@ -134,6 +134,7 @@ |
135 | 135 | * line, a virtual n+1 position is supported. Offsets beyond this virtual position will cause |
136 | 136 | * an exception to be thrown. |
137 | 137 | */ |
| 138 | +/* |
138 | 139 | if ( line === lineCount ) { |
139 | 140 | if ( offset !== lines[line].end + 1 ) { |
140 | 141 | line--; |
— | — | @@ -143,6 +144,7 @@ |
144 | 145 | throw 'Out of range error. Offset is expected to be less than or equal to text length.'; |
145 | 146 | } |
146 | 147 | } |
| 148 | +*/ |
147 | 149 | |
148 | 150 | /* |
149 | 151 | * Offset measuring |
— | — | @@ -150,14 +152,14 @@ |
151 | 153 | * Since the left position will be zero for the first character in the line, so we can skip |
152 | 154 | * measuring for those cases. |
153 | 155 | */ |
154 | | - if ( lines[line].start < offset ) { |
| 156 | + if ( this.lines[line].start < offset ) { |
155 | 157 | var $ruler = $( '<div class="editSurface-line"></div>' ).appendTo( this.$ ), |
156 | 158 | ruler = $ruler[0]; |
157 | | - ruler.innerHTML = this.escape( text.substring( lines[startLine].start, offset ) ); |
| 159 | + ruler.innerHTML = this.escape( this.lines[line].text.substring( 0, offset - this.lines[line].start ) ); |
158 | 160 | position.left = ruler.clientWidth; |
159 | 161 | $ruler.remove(); |
160 | | - } |
161 | | - |
| 162 | + } |
| 163 | + |
162 | 164 | return position; |
163 | 165 | }; |
164 | 166 | |