Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js |
— | — | @@ -340,31 +340,25 @@ |
341 | 341 | case 'left' : |
342 | 342 | case 'right' : |
343 | 343 | var offset; |
344 | | - if ( this.keyboard.keys.shift ) { |
| 344 | + if ( this.keyboard.keys.shift || this.selection.from === this.selection.to ) { |
345 | 345 | offset = this.selection.to; |
346 | 346 | } else { |
347 | | - offset = this.selection.from === this.selection.to ? |
348 | | - this.selection.to : |
349 | | - instruction === 'left' ? this.selection.start : this.selection.end; |
| 347 | + offset = instruction === 'left' ? this.selection.start : this.selection.end; |
350 | 348 | } |
351 | 349 | newTo = this.documentView.getModel().getRelativeContentOffset( |
352 | 350 | offset, |
353 | | - instruction === 'left' ? -1 : 1 |
| 351 | + instruction === 'left' ? -1 : 1 |
354 | 352 | ); |
355 | | - if ( this.keyboard.keys.control || this.keyboard.keys.alt ) { |
356 | | - var wordBoundaries = this.documentView.model.getWordBoundaries( newTo ); |
357 | | - if ( instruction === 'left' ) { |
358 | | - newTo = wordBoundaries.from; |
359 | | - |
360 | | - newTo = this.documentView.getModel().getRelativeContentOffset( |
361 | | - newTo, |
362 | | - -1 |
363 | | - ); |
364 | | - |
365 | | - } else { |
366 | | - newTo = wordBoundaries.to; |
| 353 | + |
| 354 | + if ( this.keyboard.keys.shift && ( this.keyboard.keys.control || this.keyboard.keys.alt ) ) { |
| 355 | + var wordRange = this.documentView.model.getWordBoundaries( |
| 356 | + instruction === 'left' ? newTo : offset |
| 357 | + ); |
| 358 | + if ( wordRange ) { |
| 359 | + newTo = instruction === 'left' ? wordRange.from : wordRange.to; |
367 | 360 | } |
368 | 361 | } |
| 362 | + |
369 | 363 | break; |
370 | 364 | case 'home' : |
371 | 365 | case 'end' : |