diff --git a/lib/ace/layer/text.js b/lib/ace/layer/text.js index a4af26bb..b6cb25e0 100644 --- a/lib/ace/layer/text.js +++ b/lib/ace/layer/text.js @@ -227,7 +227,8 @@ var Text = function(parentEl) { style.width = config.width + "px"; var html = []; - this.$renderLine(html, row, tokens[row-firstRow].tokens); + if (tokens.length > row-firstRow) + this.$renderLine(html, row, tokens[row-firstRow].tokens); // don't use setInnerHtml since we are working with an empty DIV lineEl.innerHTML = html.join(""); fragment.appendChild(lineEl); diff --git a/lib/ace/tokenizer.js b/lib/ace/tokenizer.js index 1bd8ab5d..50861df5 100644 --- a/lib/ace/tokenizer.js +++ b/lib/ace/tokenizer.js @@ -79,7 +79,7 @@ var Tokenizer = function(rules) { } for ( var i = 0; i < state.length; i++) { - if (match[i + 1] !== undefined) { + if (match[i + 1] !== undefined && match[i + 1].length) { if (typeof state[i].token == "function") { type = state[i].token(match[0]); }