make sure text redraw isn't missed when bgTokenizer state changes

This commit is contained in:
nightwing 2014-08-01 21:45:43 +04:00
commit f4990b3a56

View file

@ -36,8 +36,6 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
/** /**
*
*
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use. * Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use.
* *
* If a certain row is changed, everything below that row is re-tokenized. * If a certain row is changed, everything below that row is re-tokenized.
@ -50,8 +48,6 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
* @param {Tokenizer} tokenizer The tokenizer to use * @param {Tokenizer} tokenizer The tokenizer to use
* @param {Editor} editor The editor to associate with * @param {Editor} editor The editor to associate with
* *
*
*
* @constructor * @constructor
**/ **/
@ -89,10 +85,9 @@ var BackgroundTokenizer = function(tokenizer, editor) {
// only check every 5 lines // only check every 5 lines
processedLines ++; processedLines ++;
if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) { if ((processedLines % 5 === 0) && (new Date() - workerStart) > 20) {
self.running = setTimeout(self.$worker, 20); self.running = setTimeout(self.$worker, 20);
self.currentLine = currentLine; break;
return;
} }
} }
self.currentLine = currentLine; self.currentLine = currentLine;