@@ -384,20 +384,20 @@ export class WordOperations {
384384 public static word ( config : CursorConfiguration , model : ICursorSimpleModel , cursor : SingleCursorState , inSelectionMode : boolean , position : Position ) : SingleCursorState {
385385 const wordSeparators = getMapForWordSeparators ( config . wordSeparators ) ;
386386 let prevWord = WordOperations . _findPreviousWordOnLine ( wordSeparators , model , position ) ;
387- let isInPrevWord = ( prevWord && prevWord . wordType === WordType . Regular && prevWord . start < position . column - 1 && position . column - 1 <= prevWord . end ) ;
388387 let nextWord = WordOperations . _findNextWordOnLine ( wordSeparators , model , position ) ;
389- let isInNextWord = ( nextWord && nextWord . wordType === WordType . Regular && nextWord . start < position . column - 1 && position . column - 1 <= nextWord . end ) ;
390388
391389 if ( ! inSelectionMode ) {
392390 // Entering word selection for the first time
391+ const isTouchingPrevWord = ( prevWord && prevWord . wordType === WordType . Regular && prevWord . start <= position . column - 1 && position . column - 1 <= prevWord . end ) ;
392+ const isTouchingNextWord = ( nextWord && nextWord . wordType === WordType . Regular && nextWord . start <= position . column - 1 && position . column - 1 <= nextWord . end ) ;
393393
394394 let startColumn : number ;
395395 let endColumn : number ;
396396
397- if ( isInPrevWord ) {
397+ if ( isTouchingPrevWord ) {
398398 startColumn = prevWord . start + 1 ;
399399 endColumn = prevWord . end + 1 ;
400- } else if ( isInNextWord ) {
400+ } else if ( isTouchingNextWord ) {
401401 startColumn = nextWord . start + 1 ;
402402 endColumn = nextWord . end + 1 ;
403403 } else {
@@ -419,13 +419,16 @@ export class WordOperations {
419419 ) ;
420420 }
421421
422+ const isInsidePrevWord = ( prevWord && prevWord . wordType === WordType . Regular && prevWord . start < position . column - 1 && position . column - 1 < prevWord . end ) ;
423+ const isInsideNextWord = ( nextWord && nextWord . wordType === WordType . Regular && nextWord . start < position . column - 1 && position . column - 1 < nextWord . end ) ;
424+
422425 let startColumn : number ;
423426 let endColumn : number ;
424427
425- if ( isInPrevWord ) {
428+ if ( isInsidePrevWord ) {
426429 startColumn = prevWord . start + 1 ;
427430 endColumn = prevWord . end + 1 ;
428- } else if ( isInNextWord ) {
431+ } else if ( isInsideNextWord ) {
429432 startColumn = nextWord . start + 1 ;
430433 endColumn = nextWord . end + 1 ;
431434 } else {
0 commit comments