add input event, make doing multiple changes in one turn much faster
This commit is contained in:
parent
2d6f56d8fd
commit
79c0f83e2c
2 changed files with 13 additions and 2 deletions
|
|
@ -170,6 +170,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
// pretty long delay to prevent the tokenizer from interfering with the user
|
||||
this.running = setTimeout(this.$worker, 700);
|
||||
};
|
||||
|
||||
this.scheduleStart = function() {
|
||||
this.running = setTimeout(this.$worker, 700);
|
||||
}
|
||||
|
||||
this.$updateOnChange = function(delta) {
|
||||
var range = delta.range;
|
||||
|
|
@ -191,8 +195,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
|
||||
|
||||
this.stop();
|
||||
// pretty long delay to prevent the tokenizer from interfering with the user
|
||||
this.running = setTimeout(this.$worker, 700);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -90,6 +90,15 @@ var Editor = function(renderer, session) {
|
|||
this.commands.on("exec", this.$historyTracker);
|
||||
|
||||
this.$initOperationListeners();
|
||||
|
||||
this._$emitInputEvent = lang.delayedCall(function() {
|
||||
this._signal("input", {});
|
||||
this.session.bgTokenizer && this.session.bgTokenizer.scheduleStart();
|
||||
}.bind(this));
|
||||
|
||||
this.on("change", function(_, _self) {
|
||||
_self._$emitInputEvent.schedule(31);
|
||||
});
|
||||
|
||||
this.setSession(session || new EditSession(""));
|
||||
config.resetOptions(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue