tabs to spaces

This commit is contained in:
nightwing 2011-10-04 23:20:05 +05:00
commit b99710cd9e
2 changed files with 31 additions and 31 deletions

View file

@ -230,7 +230,7 @@ var Editor =function(renderer, session) {
this.unsetStyle = function(style) { this.unsetStyle = function(style) {
this.renderer.unsetStyle(style); this.renderer.unsetStyle(style);
}; };
this.setFontSize = function(size) { this.setFontSize = function(size) {
this.container.style.fontSize = size; this.container.style.fontSize = size;
}; };
@ -269,7 +269,7 @@ var Editor =function(renderer, session) {
}); });
this.textInput.focus(); this.textInput.focus();
}; };
this.isFocused = function() { this.isFocused = function() {
return this.textInput.isFocused(); return this.textInput.isFocused();
}; };
@ -407,7 +407,7 @@ var Editor =function(renderer, session) {
var text = ""; var text = "";
if (!this.selection.isEmpty()) if (!this.selection.isEmpty())
text = this.session.getTextRange(this.getSelectionRange()); text = this.session.getTextRange(this.getSelectionRange());
this._emit("copy", text); this._emit("copy", text);
return text; return text;
}; };
@ -523,7 +523,7 @@ var Editor =function(renderer, session) {
this.onTextInput = function(text, notPasted) { this.onTextInput = function(text, notPasted) {
if (!notPasted) if (!notPasted)
this._emit("paste", text); this._emit("paste", text);
// In case the text was not pasted and we got only one character, then // In case the text was not pasted and we got only one character, then
// handel it as a command key stroke. // handel it as a command key stroke.
if (notPasted && text.length == 1) { if (notPasted && text.length == 1) {
@ -661,11 +661,11 @@ var Editor =function(renderer, session) {
return; return;
if (this.selection.isEmpty()){ if (this.selection.isEmpty()){
if(dir == "left") if(dir == "left")
this.selection.selectLeft(); this.selection.selectLeft();
else else
this.selection.selectRight(); this.selection.selectRight();
} }
var range = this.getSelectionRange(); var range = this.getSelectionRange();
if (this.getBehavioursEnabled()) { if (this.getBehavioursEnabled()) {
@ -673,7 +673,7 @@ var Editor =function(renderer, session) {
var state = session.getState(range.start.row); var state = session.getState(range.start.row);
var new_range = session.getMode().transformAction(state, 'deletion', this, session, range); var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
if (new_range === false) if (new_range === false)
return; return;
if (new_range) if (new_range)
range = new_range; range = new_range;
} }

View file

@ -104,9 +104,9 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
this.$normalizePath = function(path) { this.$normalizePath = function(path) {
if (!path.match(/^\w+:/)) { if (!path.match(/^\w+:/)) {
path = location.protocol + "//" + location.host path = location.protocol + "//" + location.host
// paths starting with a slash are relative to the root (host) // paths starting with a slash are relative to the root (host)
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, "")) + (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, ""); + "/" + path.replace(/^[\/]+/, "");
} }
return path; return path;
@ -115,7 +115,7 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
this.$guessBasePath = function() { this.$guessBasePath = function() {
if (require.aceBaseUrl) if (require.aceBaseUrl)
return require.aceBaseUrl; return require.aceBaseUrl;
var scripts = document.getElementsByTagName("script"); var scripts = document.getElementsByTagName("script");
for (var i=0; i<scripts.length; i++) { for (var i=0; i<scripts.length; i++) {
var script = scripts[i]; var script = scripts[i];
@ -123,7 +123,7 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
var base = script.getAttribute("data-ace-base"); var base = script.getAttribute("data-ace-base");
if (base) if (base)
return base.replace(/\/*$/, "/"); return base.replace(/\/*$/, "/");
var src = script.src || script.getAttribute("src"); var src = script.src || script.getAttribute("src");
if (!src) { if (!src) {
continue; continue;
@ -139,8 +139,8 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
this._dispatchEvent("terminate", {}); this._dispatchEvent("terminate", {});
this.$worker.terminate(); this.$worker.terminate();
this.$worker = null; this.$worker = null;
this.$doc.removeEventListener("change", this.changeListener); this.$doc.removeEventListener("change", this.changeListener);
this.$doc = null; this.$doc = null;
}; };
this.send = function(cmd, args) { this.send = function(cmd, args) {
@ -164,23 +164,23 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
} }
catch(ex) {} catch(ex) {}
}; };
this.attachToDocument = function(doc) {
if(this.$doc)
this.terminate();
this.$doc = doc; this.attachToDocument = function(doc) {
this.call("setValue", [doc.getValue()]); if(this.$doc)
this.terminate();
this.$doc = doc;
this.call("setValue", [doc.getValue()]);
doc.on("change", this.changeListener); doc.on("change", this.changeListener);
}; };
this.changeListener = function(e) { this.changeListener = function(e) {
e.range = { e.range = {
start: e.data.range.start, start: e.data.range.start,
end: e.data.range.end end: e.data.range.end
}; };
this.emit("change", e); this.emit("change", e);
}; };
}).call(WorkerClient.prototype); }).call(WorkerClient.prototype);