Skip to content

Commit 0f8715c

Browse files
feizhang365marijnh
authored andcommitted
Update lib/codemirror.js
fix double click to select a Chinese word in quotes bug: e.g:<div name='新增'>新增</div>  double click to select word 新增   
1 parent 431b443 commit 0f8715c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/codemirror.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ window.CodeMirror = (function() {
14181418
var startChar = line.charAt(start);
14191419
var check = isWordChar(startChar) ? isWordChar :
14201420
/\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} :
1421-
function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
1421+
function(ch) {return !/\s/.test(ch) && isWordChar(ch);};
14221422
while (start > 0 && check(line.charAt(start - 1))) --start;
14231423
while (end < line.length && check(line.charAt(end))) ++end;
14241424
}
@@ -3101,7 +3101,7 @@ window.CodeMirror = (function() {
31013101
return -1;
31023102
}
31033103
function isWordChar(ch) {
3104-
return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase();
3104+
return /\w/.test(ch) || ch.toUpperCase() != ch.toLowerCase() || /[\u4E00-\u9FA5]/.test(ch);
31053105
}
31063106

31073107
// See if "".split is the broken IE version, if so, provide an

0 commit comments

Comments
 (0)