fix infinite loop in computeWrapSplits
This commit is contained in:
parent
e8914acd7b
commit
7ad4734e24
2 changed files with 8 additions and 2 deletions
|
|
@ -1301,10 +1301,11 @@ var EditSession = function(text, mode) {
|
||||||
while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
|
while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
|
||||||
split --;
|
split --;
|
||||||
}
|
}
|
||||||
|
while (split > minSplit && tokens[split] == PUNCTUATION) {
|
||||||
|
split --;
|
||||||
|
}
|
||||||
// If we found one, then add the split.
|
// If we found one, then add the split.
|
||||||
if (split > minSplit) {
|
if (split > minSplit) {
|
||||||
while(split > minSplit && tokens[split] == PUNCTUATION)
|
|
||||||
split --;
|
|
||||||
addSplit(++split);
|
addSplit(++split);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -346,6 +346,11 @@ module.exports = {
|
||||||
computeAndAssert(" ぁぁ", [1, 2], 2);
|
computeAndAssert(" ぁぁ", [1, 2], 2);
|
||||||
computeAndAssert(" ぁ\tぁ", [1, 3], 2);
|
computeAndAssert(" ぁ\tぁ", [1, 3], 2);
|
||||||
computeAndAssert(" ぁぁ\tぁ", [1, 4], 4);
|
computeAndAssert(" ぁぁ\tぁ", [1, 4], 4);
|
||||||
|
|
||||||
|
// Test wrapping for punctuation.
|
||||||
|
computeAndAssert(" ab.c;ef++", [1, 3, 5, 7, 8], 2);
|
||||||
|
computeAndAssert(" a.b", [1, 2, 3], 1);
|
||||||
|
computeAndAssert("#>>", [1, 2], 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
"test get longest line" : function() {
|
"test get longest line" : function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue