merge
This commit is contained in:
commit
6589eee14a
2 changed files with 53 additions and 37 deletions
|
|
@ -947,18 +947,12 @@ var EditSession = function(text, mode) {
|
|||
arr.push(TAB_SPACE);
|
||||
}
|
||||
}
|
||||
// Space
|
||||
else if(c == 32) {
|
||||
arr.push(SPACE);
|
||||
}
|
||||
// CJK characters
|
||||
else if (
|
||||
c >= 0x3040 && c <= 0x309F || // Hiragana
|
||||
c >= 0x30A0 && c <= 0x30FF || // Katakana
|
||||
c >= 0x4E00 && c <= 0x9FFF || // Single CJK ideographs
|
||||
c >= 0xF900 && c <= 0xFAFF ||
|
||||
c >= 0x3400 && c <= 0x4DBF
|
||||
) {
|
||||
// Space
|
||||
else if(c == 32) {
|
||||
arr.push(SPACE);
|
||||
}
|
||||
// full width characters
|
||||
else if (isFullWidth(c)) {
|
||||
arr.push(CHAR, CHAR_EXT);
|
||||
} else {
|
||||
arr.push(CHAR);
|
||||
|
|
@ -984,21 +978,15 @@ var EditSession = function(text, mode) {
|
|||
if (c == 9) {
|
||||
screenColumn += this.getScreenTabSize(screenColumn);
|
||||
}
|
||||
// CJK characters
|
||||
else if (
|
||||
c >= 0x3040 && c <= 0x309F || // Hiragana
|
||||
c >= 0x30A0 && c <= 0x30FF || // Katakana
|
||||
c >= 0x4E00 && c <= 0x9FFF || // Single CJK ideographs
|
||||
c >= 0xF900 && c <= 0xFAFF ||
|
||||
c >= 0x3400 && c <= 0x4DBF
|
||||
) {
|
||||
screenColumn += 2;
|
||||
} else {
|
||||
screenColumn += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return screenColumn;
|
||||
// full width characters
|
||||
else if (isFullWidth(c)) {
|
||||
screenColumn += 2;
|
||||
} else {
|
||||
screenColumn += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return screenColumn;
|
||||
}
|
||||
|
||||
this.getRowHeight = function(config, row) {
|
||||
|
|
@ -1148,15 +1136,8 @@ var EditSession = function(text, mode) {
|
|||
docColumn -= 1;
|
||||
}
|
||||
}
|
||||
// CJK characters
|
||||
else if (
|
||||
c >= 0x3040 && c <= 0x309F || // Hiragana
|
||||
c >= 0x30A0 && c <= 0x30FF || // Katakana
|
||||
c >= 0x4E00 && c <= 0x9FFF || // Single CJK ideographs
|
||||
c >= 0xF900 && c <= 0xFAFF ||
|
||||
c >= 0x3400 && c <= 0x4DBF
|
||||
) {
|
||||
screenColumn += 2;
|
||||
// full width characters
|
||||
else if (isFullWidth(c)) {
|
||||
if (remaining >= 2) {
|
||||
remaining -= 2;
|
||||
} else {
|
||||
|
|
@ -1293,6 +1274,41 @@ var EditSession = function(text, mode) {
|
|||
}
|
||||
return screenRows;
|
||||
}
|
||||
|
||||
function isFullWidth(c) {
|
||||
return c >= 0x1100 && c <= 0x115F ||
|
||||
c >= 0x11A3 && c <= 0x11A7 ||
|
||||
c >= 0x11FA && c <= 0x11FF ||
|
||||
c >= 0x2329 && c <= 0x232A ||
|
||||
c >= 0x2E80 && c <= 0x2E99 ||
|
||||
c >= 0x2E9B && c <= 0x2EF3 ||
|
||||
c >= 0x2F00 && c <= 0x2FD5 ||
|
||||
c >= 0x2FF0 && c <= 0x2FFB ||
|
||||
c >= 0x3000 && c <= 0x303E ||
|
||||
c >= 0x3041 && c <= 0x3096 ||
|
||||
c >= 0x3099 && c <= 0x30FF ||
|
||||
c >= 0x3105 && c <= 0x312D ||
|
||||
c >= 0x3131 && c <= 0x318E ||
|
||||
c >= 0x3190 && c <= 0x31BA ||
|
||||
c >= 0x31C0 && c <= 0x31E3 ||
|
||||
c >= 0x31F0 && c <= 0x321E ||
|
||||
c >= 0x3220 && c <= 0x3247 ||
|
||||
c >= 0x3250 && c <= 0x32FE ||
|
||||
c >= 0x3300 && c <= 0x4DBF ||
|
||||
c >= 0x4E00 && c <= 0xA48C ||
|
||||
c >= 0xA490 && c <= 0xA4C6 ||
|
||||
c >= 0xA960 && c <= 0xA97C ||
|
||||
c >= 0xAC00 && c <= 0xD7A3 ||
|
||||
c >= 0xD7B0 && c <= 0xD7C6 ||
|
||||
c >= 0xD7CB && c <= 0xD7FB ||
|
||||
c >= 0xF900 && c <= 0xFAFF ||
|
||||
c >= 0xFE10 && c <= 0xFE19 ||
|
||||
c >= 0xFE30 && c <= 0xFE52 ||
|
||||
c >= 0xFE54 && c <= 0xFE66 ||
|
||||
c >= 0xFE68 && c <= 0xFE6B ||
|
||||
c >= 0xFF01 && c <= 0xFF60 ||
|
||||
c >= 0xFFE0 && c <= 0xFFE6;
|
||||
}
|
||||
|
||||
}).call(EditSession.prototype);
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ var Text = function(parentEl) {
|
|||
|
||||
function addToken(token, value) {
|
||||
var output = value
|
||||
.replace(/\t|&|<|( +)|([\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000])|[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF]/g, function(c, a, b, tabIdx, idx4) {
|
||||
.replace(/\t|&|<|( +)|([\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000])|[\u1100-\u115F]|[\u11A3-\u11A7]|[\u11FA-\u11FF]|[\u2329-\u232A]|[\u2E80-\u2E99]|[\u2E9B-\u2EF3]|[\u2F00-\u2FD5]|[\u2FF0-\u2FFB]|[\u3000-\u303E]|[\u3041-\u3096]|[\u3099-\u30FF]|[\u3105-\u312D]|[\u3131-\u318E]|[\u3190-\u31BA]|[\u31C0-\u31E3]|[\u31F0-\u321E]|[\u3220-\u3247]|[\u3250-\u32FE]|[\u3300-\u4DBF]|[\u4E00-\uA48C]|[\uA490-\uA4C6]|[\uA960-\uA97C]|[\uAC00-\uD7A3]|[\uD7B0-\uD7C6]|[\uD7CB-\uD7FB]|[\uF900-\uFAFF]|[\uFE10-\uFE19]|[\uFE30-\uFE52]|[\uFE54-\uFE66]|[\uFE68-\uFE6B]|[\uFF01-\uFF60]|[\uFFE0-\uFFE6]/g, function(c, a, b, tabIdx, idx4) {
|
||||
if (c.charCodeAt(0) == 32) {
|
||||
return new Array(c.length+1).join(" ");
|
||||
} else if (c == "\t") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue