Merge remote branch 'upstream/master'

This commit is contained in:
dgeorge 2011-10-28 14:27:16 -07:00
commit 62a788c391
3 changed files with 19 additions and 16 deletions

View file

@ -1105,6 +1105,7 @@ var EditSession = function(text, mode) {
CHAR_EXT = 2,
PLACEHOLDER_START = 3,
PLACEHOLDER_BODY = 4,
PUNCTUATION = 9,
SPACE = 10,
TAB = 11,
TAB_SPACE = 12;
@ -1148,7 +1149,7 @@ var EditSession = function(text, mode) {
// a split is simple.
if (tokens[split] >= SPACE) {
// Include all following spaces + tabs in this split as well.
while (tokens[split] >= SPACE) {
while (tokens[split] >= SPACE) {
split ++;
}
addSplit(split);
@ -1203,16 +1204,16 @@ var EditSession = function(text, mode) {
}
// === ELSE ===
// Search for the first non space/tab/placeholder token backwards.
for (split; split != lastSplit - 1; split--) {
if (tokens[split] >= PLACEHOLDER_START) {
split++;
break;
}
// Search for the first non space/tab/placeholder/punctuation token backwards.
var minSplit = Math.max(split - 10, lastSplit - 1);
while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
split --;
}
// If we found one, then add the split.
if (split > lastSplit) {
addSplit(split);
if (split > minSplit) {
while(split > minSplit && tokens[split] == PUNCTUATION)
split --;
addSplit(++split);
continue;
}
@ -1220,7 +1221,7 @@ var EditSession = function(text, mode) {
split = lastSplit + wrapLimit;
// The split is inside of a CHAR or CHAR_EXT token and no space
// around -> force a split.
addSplit(lastSplit + wrapLimit);
addSplit(split);
}
return splits;
}
@ -1246,11 +1247,13 @@ var EditSession = function(text, mode) {
}
}
// Space
else if(c == 32) {
else if (c == 32) {
arr.push(SPACE);
} else if((c > 39 && c < 48) || (c > 57 && c < 64)) {
arr.push(PUNCTUATION);
}
// full width characters
else if (isFullWidth(c)) {
else if (c >= 0x1100 && isFullWidth(c)) {
arr.push(CHAR, CHAR_EXT);
} else {
arr.push(CHAR);
@ -1286,7 +1289,7 @@ var EditSession = function(text, mode) {
screenColumn += this.getScreenTabSize(screenColumn);
}
// full width characters
else if (isFullWidth(c)) {
else if (c >= 0x1100 && isFullWidth(c)) {
screenColumn += 2;
} else {
screenColumn += 1;

View file

@ -93,8 +93,8 @@ var vimStates = {
},
vimcommand("(k|up)", "golineup"),
vimcommand("(j|down)", "golinedown"),
vimcommand("(l|right)", "golineright"),
vimcommand("(h|left)", "golineleft"),
vimcommand("(l|right)", "gotoright"),
vimcommand("(h|left)", "gotoleft"),
{
key: "shift-g",
exec: "gotoend"

View file

@ -54,7 +54,7 @@ define(function(require, exports, module) {
var keywords = lang.arrayToMap((
"this|throw|then|try|typeof|super|switch|return|break|by)|continue|" +
"catch|class|in|instanceof|is|isnt|if|else|extends|for|forown|" +
"finally|function|while|when|new|not|delete|debugger|do|loop|of|off|" +
"finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
"or|on|unless|until|and|yes").split("|")
);