use delayedCall instead of setTimeout

This commit is contained in:
nightwing 2013-03-18 21:54:39 +04:00
commit d97de5c149
2 changed files with 15 additions and 17 deletions

View file

@ -98,7 +98,7 @@ var modesByName = {
tex: ["Tex" , "tex"], tex: ["Tex" , "tex"],
text: ["Text" , "txt"], text: ["Text" , "txt"],
textile: ["Textile" , "textile"], textile: ["Textile" , "textile"],
tm_snippet: ["tmSnippet" , "tmSnippet"], tmsnippet: ["tmSnippet" , "tmSnippet"],
toml: ["toml" , "toml"], toml: ["toml" , "toml"],
typescript: ["Typescript" , "typescript|ts|str"], typescript: ["Typescript" , "typescript|ts|str"],
vbscript: ["VBScript" , "vbs"], vbscript: ["VBScript" , "vbs"],

View file

@ -510,7 +510,7 @@ var TabstopManager = function(editor) {
return editor.tabstopManager; return editor.tabstopManager;
editor.tabstopManager = this; editor.tabstopManager = this;
this.$onChange = this.onChange.bind(this); this.$onChange = this.onChange.bind(this);
this.$onChangeSelection = this.onChangeSelection.bind(this); this.$onChangeSelection = lang.delayedCall(this.onChangeSelection.bind(this)).schedule;
this.$onChangeSession = this.onChangeSession.bind(this); this.$onChangeSession = this.onChangeSession.bind(this);
this.$onAfterExec = this.onAfterExec.bind(this); this.$onAfterExec = this.onAfterExec.bind(this);
this.attach(editor); this.attach(editor);
@ -606,13 +606,13 @@ var TabstopManager = function(editor) {
var fmt = exports.SnippetManager.tmStrFormat(text, range.original) var fmt = exports.SnippetManager.tmStrFormat(text, range.original)
session.replace(range, fmt); session.replace(range, fmt);
} }
this.$inChange = false;
}; };
this.onAfterExec = function(e) { this.onAfterExec = function(e) {
if (e.command && !e.command.readOnly) if (e.command && !e.command.readOnly)
this.updateLinkedFields(); this.updateLinkedFields();
}; };
this.onChangeSelection = function() { this.onChangeSelection = function() {
setTimeout(function() {
if (!this.editor) if (!this.editor)
return return
var lead = this.editor.selection.lead; var lead = this.editor.selection.lead;
@ -625,12 +625,10 @@ var TabstopManager = function(editor) {
return; return;
} }
this.detach(); this.detach();
}.bind(this));
}; };
this.onChangeSession = function() { this.onChangeSession = function() {
this.detach(); this.detach();
}; };
this.tabNext = function(dir) { this.tabNext = function(dir) {
var max = this.tabstops.length - 1; var max = this.tabstops.length - 1;
var index = this.index + (dir || 1); var index = this.index + (dir || 1);