Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js |
— | — | @@ -172,8 +172,8 @@ |
173 | 173 | this.mouse.selectingMode = 3; // used in mouseMove handler |
174 | 174 | |
175 | 175 | var node = this.documentView.getNodeFromOffset( offset ); |
176 | | - this.selection.from = this.documentView.getOffsetFromNode( node, false ); |
177 | | - this.selection.to = this.selection.from + node.getElementLength() - 1; |
| 176 | + this.selection.from = this.documentView.getOffsetFromNode( node, false ) + 1; |
| 177 | + this.selection.to = this.selection.from + node.getElementLength() - 2; |
178 | 178 | this.mouse.selectedRange = this.selection.clone(); |
179 | 179 | } |
180 | 180 | |
— | — | @@ -355,6 +355,12 @@ |
356 | 356 | tx = this.documentView.model.prepareRemoval( range ); |
357 | 357 | this.documentView.model.commit ( tx ); |
358 | 358 | } |
| 359 | + } else { |
| 360 | + var tx = this.documentView.model.prepareRemoval( this.selection ); |
| 361 | + this.documentView.model.commit( tx ); |
| 362 | + this.documentView.clearSelection(); |
| 363 | + this.selection.to = this.selection.from; |
| 364 | + this.showCursor(); |
359 | 365 | } |
360 | 366 | break; |
361 | 367 | case 46: // Delete |
— | — | @@ -393,6 +399,12 @@ |
394 | 400 | tx = this.documentView.model.prepareRemoval( range ); |
395 | 401 | this.documentView.model.commit ( tx ); |
396 | 402 | } |
| 403 | + } else { |
| 404 | + var tx = this.documentView.model.prepareRemoval( this.selection ); |
| 405 | + this.documentView.model.commit( tx ); |
| 406 | + this.documentView.clearSelection(); |
| 407 | + this.selection.to = this.selection.from; |
| 408 | + this.showCursor(); |
397 | 409 | } |
398 | 410 | break; |
399 | 411 | case 13: // Enter |