@@ -1091,7 +1091,7 @@ var CodeMirror = (function() {
10911091 var sawWord = false ;
10921092 for ( ; ; ) {
10931093 if ( dir < 0 ) if ( ! moveOnce ( ) ) break ;
1094- if ( / \w / . test ( lineObj . text . charAt ( ch ) ) ) sawWord = true ;
1094+ if ( isWordChar ( lineObj . text . charAt ( ch ) ) ) sawWord = true ;
10951095 else if ( sawWord ) { if ( dir < 0 ) { dir = 1 ; moveOnce ( ) ; } break ; }
10961096 if ( dir > 0 ) if ( ! moveOnce ( ) ) break ;
10971097 }
@@ -1123,8 +1123,8 @@ var CodeMirror = (function() {
11231123 function selectWordAt ( pos ) {
11241124 var line = getLine ( pos . line ) . text ;
11251125 var start = pos . ch , end = pos . ch ;
1126- while ( start > 0 && / \w / . test ( line . charAt ( start - 1 ) ) ) -- start ;
1127- while ( end < line . length && / \w / . test ( line . charAt ( end ) ) ) ++ end ;
1126+ while ( start > 0 && isWordChar ( line . charAt ( start - 1 ) ) ) -- start ;
1127+ while ( end < line . length && isWordChar ( line . charAt ( end ) ) ) ++ end ;
11281128 setSelectionUser ( { line : pos . line , ch : start } , { line : pos . line , ch : end } ) ;
11291129 }
11301130 function selectLine ( line ) {
@@ -2697,6 +2697,9 @@ var CodeMirror = (function() {
26972697 if ( collection [ i ] == elt ) return i ;
26982698 return - 1 ;
26992699 }
2700+ function isWordChar ( ch ) {
2701+ return / \w / . test ( ch ) || ch . toUpperCase ( ) != ch . toLowerCase ( ) ;
2702+ }
27002703
27012704 // See if "".split is the broken IE version, if so, provide an
27022705 // alternative way to split lines.
0 commit comments