fix error in detectSettingsOnLoad

pull/85/head
nightwing 2015-04-16 04:56:02 +04:00 zatwierdzone przez nightwing
rodzic 4b4942334d
commit 60c9d3450c
1 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -1325,7 +1325,7 @@ define(function(require, exports, module) {
syntax = "json"; syntax = "json";
} }
else if (/\.(bashrc|inputrc)$/.test(path)) { else if (/\.(bashrc|inputrc)$/.test(path)) {
syntax = "bash"; syntax = "sh";
} }
else if (/\.(git(attributes|config|ignore)|npmrc)$/.test(path)) { else if (/\.(git(attributes|config|ignore)|npmrc)$/.test(path)) {
syntax = "ini"; syntax = "ini";
@ -2121,12 +2121,12 @@ define(function(require, exports, module) {
bgStyle.bottom = upload ? "" : 0; bgStyle.bottom = upload ? "" : 0;
} }
function detectSettingsOnLoad(c9Session) { function detectSettingsOnLoad(c9Session, doc) {
var session = c9Session.session; var session = c9Session.session;
if (settings.get("project/ace/@guessTabSize")) if (settings.get("project/ace/@guessTabSize"))
whitespaceUtil.detectIndentation(session); whitespaceUtil.detectIndentation(session);
if (!session.syntax) { if (!session.syntax) {
var syntax = detectSyntax(c9Session); var syntax = detectSyntax(c9Session, doc && doc.tab && doc.tab.path);
if (syntax) if (syntax)
setSyntax(c9Session, syntax, true); setSyntax(c9Session, syntax, true);
} }
@ -2183,7 +2183,7 @@ define(function(require, exports, module) {
// aceSession.doc.setValue(e.value || ""); // aceSession.doc.setValue(e.value || "");
} else { } else {
aceSession.setValue(e.value || ""); aceSession.setValue(e.value || "");
detectSettingsOnLoad(c9Session); detectSettingsOnLoad(c9Session, doc);
hideProgress(); hideProgress();
} }
@ -2295,7 +2295,7 @@ define(function(require, exports, module) {
setState(doc, e.state); setState(doc, e.state);
if (doc.meta.newfile) { if (doc.meta.newfile) {
detectSettingsOnLoad(c9Session); detectSettingsOnLoad(c9Session, doc);
aceSession.on("change", function detectIndentation() { aceSession.on("change", function detectIndentation() {
if (aceSession.$guessTabSize) { if (aceSession.$guessTabSize) {
if (aceSession.getLength() <= 2) return; if (aceSession.getLength() <= 2) return;
@ -2306,7 +2306,7 @@ define(function(require, exports, module) {
aceSession.off("change", detectIndentation); aceSession.off("change", detectIndentation);
}); });
} else if (doc.hasValue()) { } else if (doc.hasValue()) {
detectSettingsOnLoad(c9Session); detectSettingsOnLoad(c9Session, doc);
} }
// Create the ace like undo manager that proxies to // Create the ace like undo manager that proxies to