Add support for background tokenizing

This commit is contained in:
Fabian Jakobs 2010-04-08 18:46:43 +02:00
commit 1683f3e90f
6 changed files with 196 additions and 9 deletions

View file

@ -115,6 +115,10 @@ function Editor(doc, renderer)
doc.addChangeListener(lib.bind(this.onDocumentChange, this));
renderer.setDocument(doc);
this.tokenizer = new BackgroundTokenizer(lib.bind(this.onTokenizerUpdate, this));
this.tokenizer.setLines(doc.lines);
renderer.setTokenizer(this.tokenizer);
this.cursor = {
row: 0,
column: 0
@ -147,9 +151,16 @@ function Editor(doc, renderer)
this.renderer.visualizeBlur();
},
onDocumentChange : function(startRow, endRow) {
onDocumentChange : function(startRow, endRow)
{
this.tokenizer.start(startRow);
this.renderer.updateLines(startRow, endRow);
},
},
onTokenizerUpdate : function(startRow, endRow) {
console.log("token update", startRow, endRow);
this.renderer.updateLines(startRow, endRow);
},
onMouseDown : function(e)
{