From 0e4993f015c265ed5633fed2eab04f2556b4dc2d Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Mon, 23 May 2011 08:45:33 +0000 Subject: [PATCH] fix tokenizer caching. Fixes #256 --- lib/ace/background_tokenizer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ace/background_tokenizer.js b/lib/ace/background_tokenizer.js index f845e3f1..6cf92543 100644 --- a/lib/ace/background_tokenizer.js +++ b/lib/ace/background_tokenizer.js @@ -141,6 +141,9 @@ var BackgroundTokenizer = function(tokenizer, editor) { if (firstRow > 0 && this.lines[firstRow - 1]) { state = this.lines[firstRow - 1].state; doCache = true; + } else if (firstRow == 0) { + state = "start"; + doCache = true; } var lines = this.doc.getLines(firstRow, lastRow); @@ -150,6 +153,7 @@ var BackgroundTokenizer = function(tokenizer, editor) { var state = tokens.state; rows.push(tokens); + console.log("do cache", doCache, row, state) if (doCache) { this.lines[row] = tokens; }