Index: trunk/extensions/VisualEditor/modules/es/models/es.DocumentModel.js |
— | — | @@ -822,10 +822,13 @@ |
823 | 823 | * @returns {es.Range|null} Range of content making up a whole word or null if offset is not content |
824 | 824 | */ |
825 | 825 | es.DocumentModel.prototype.getWordBoundaries = function( offset ) { |
826 | | - if ( es.DocumentModel.isStructuralOffset( this.data, offset ) ) { |
| 826 | + if ( es.DocumentModel.isStructuralOffset( this.data, offset ) || |
| 827 | + es.DocumentModel.isElementData( this.data, offset ) ) { |
827 | 828 | return null; |
828 | 829 | } |
829 | | - var start = offset, |
| 830 | + |
| 831 | + var regex = this.data[offset].match( /\B/ ) ? /\b/ : /\B/, |
| 832 | + start = offset, |
830 | 833 | end = offset, |
831 | 834 | item; |
832 | 835 | while ( start > 0 ) { |
— | — | @@ -835,7 +838,7 @@ |
836 | 839 | break; |
837 | 840 | } |
838 | 841 | item = typeof this.data[start] === 'string' ? this.data[start] : this.data[start][0]; |
839 | | - if ( item.match( /\B/ ) ) { |
| 842 | + if ( item.match( regex ) ) { |
840 | 843 | start++; |
841 | 844 | break; |
842 | 845 | } |
— | — | @@ -845,7 +848,7 @@ |
846 | 849 | break; |
847 | 850 | } |
848 | 851 | item = typeof this.data[end] === 'string' ? this.data[end] : this.data[end][0]; |
849 | | - if ( item.match( /\B/ ) ) { |
| 852 | + if ( item.match( regex ) ) { |
850 | 853 | break; |
851 | 854 | } |
852 | 855 | end++; |