Merge remote-tracking branch 'origin/master' into revert-attempt

Conflicts:
	package.json
	plugins/c9.ide.performancestats/stats.js
	plugins/c9.worker/backup.js
pull/39/head^2
Lennart Kats 2015-03-03 10:25:46 +01:00
commit 4a0a75adf8
10 zmienionych plików z 76 dodań i 38 usunięć

Wyświetl plik

@ -46,19 +46,20 @@ exports.$detectIndentation = function(lines, fallback) {
if (!/^\s*[^*+\-\s]/.test(line))
continue;
if (line[0] == "\t")
if (line[0] == "\t") {
tabIndents++;
var spaces = line.match(/^ */)[0].length;
if (spaces && line[spaces] != "\t") {
var diff = spaces - prevSpaces;
if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
changes[diff] = (changes[diff] || 0) + 1;
stats[spaces] = (stats[spaces] || 0) + 1;
prevSpaces = -Number.MAX_VALUE;
} else {
var spaces = line.match(/^ */)[0].length;
if (spaces && line[spaces] != "\t") {
var diff = spaces - prevSpaces;
if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
changes[diff] = (changes[diff] || 0) + 1;
stats[spaces] = (stats[spaces] || 0) + 1;
}
prevSpaces = spaces;
}
prevSpaces = spaces;
// ignore lines ending with backslash
while (i < max && line[line.length - 1] == "\\")
line = lines[i++];
@ -81,7 +82,7 @@ exports.$detectIndentation = function(lines, fallback) {
spaceIndents = score;
score = stats[1] ? 0.9 : 0.8;
if (!stats.length)
score = 0
score = 0;
} else
score /= spaceIndents;
@ -95,9 +96,11 @@ exports.$detectIndentation = function(lines, fallback) {
if (first.score && first.score > 1.4)
var tabLength = first.length;
if (tabIndents > spaceIndents + 1)
if (tabIndents > spaceIndents + 1) {
if (tabLength == 1 || spaceIndents < tabIndents / 4 || first.score < 1.8)
tabLength = undefined;
return {ch: "\t", length: tabLength};
}
if (spaceIndents > tabIndents + 1)
return {ch: " ", length: tabLength};
};

Wyświetl plik

@ -29,7 +29,13 @@ module.exports = {
assert.equal(indent.ch, "\t");
assert.equal(indent.length, undefined);
s.insert({row: 0, column: 0}, " ");
s.insert({row: 0, column: 0}, " ");
indent = whitespace.$detectIndentation(s.doc.$lines);
assert.equal(indent.ch, "\t");
assert.equal(indent.length, undefined);
s.doc.removeInLine(0, 0, 1);
s.insert({row: 0, column: 0}, "x\n y\n");
indent = whitespace.$detectIndentation(s.doc.$lines);
assert.equal(indent.ch, "\t");
assert.equal(indent.length, 4);

Wyświetl plik

@ -3,10 +3,13 @@
"use server";
"use mocha";
require("c9/inline-mocha")(module);
var expect = require('chai').expect;
describe('vfs-local', function () {
this.timeout(5000);
var root = __dirname + "/mock2/";
var base = root.substr(0, root.length - 1);

2
node_modules/vfs-socket/worker.js wygenerowano vendored
Wyświetl plik

@ -168,7 +168,7 @@ function Worker(vfs) {
streams[id] = stream;
stream.id = id;
stream.on("error", function(err) {
remote.onError(id, err);
remote.onError && remote.onError(id, err);
});
if (stream.readable) {
stream.on("data", function (chunk) {

Wyświetl plik

@ -12,7 +12,7 @@
"dependencies": {
"acorn": ">=0.11.0",
"amd-loader": "~0.0.5",
"async": "~0.2.7",
"async": "^0.9.0",
"base64id": "~0.1.0",
"c9": "0.1.0",
"connect": "~2.12.0",
@ -64,8 +64,8 @@
"c9.ide.local": "#2bfd7ff051",
"c9.ide.find": "#989c06e6a7",
"c9.ide.find.infiles": "#28b3cfcb47",
"c9.ide.find.replace": "#43a6b95e6a",
"c9.ide.run.debug": "#789019f9a7",
"c9.ide.find.replace": "#e4daf722b8",
"c9.ide.run.debug": "#36245ee2aa",
"c9.ide.ace.emmet": "#e5f1a92ac3",
"c9.ide.ace.gotoline": "#4d1a93172c",
"c9.ide.ace.keymaps": "#2477fd8ac6",

Wyświetl plik

@ -632,6 +632,11 @@ define(function(require, exports, module) {
max: "64",
position: 100
},
"Autodetect Tab Size on Load" : {
type: "checkbox",
path: "project/ace/@guessTabSize",
position: 150
},
"New File Line Endings" : {
type: "dropdown",
path: "project/ace/@newLineMode",
@ -1977,6 +1982,7 @@ define(function(require, exports, module) {
}
function hideProgress(){
if (!ace) return; // ace was destroyed during timeout
var style = progress.background.style;
function hide() {
style.display = "none";
@ -1993,7 +1999,6 @@ define(function(require, exports, module) {
style.opacity = 0;
ace.renderer.unfreeze();
// ace.resize(true);
}
function showProgress(value, upload, t) {
@ -2052,7 +2057,8 @@ define(function(require, exports, module) {
function detectSettingsOnLoad(c9Session) {
var session = c9Session.session;
whitespaceUtil.detectIndentation(session);
if (settings.get("project/ace/@guessTabSize"))
whitespaceUtil.detectIndentation(session);
if (!session.syntax) {
var syntax = detectSyntax(c9Session);
if (syntax)

Wyświetl plik

@ -39,13 +39,16 @@ define(function(require, module, exports) {
// Listen to changes and detect when the value of the editor
// is different from what is on disk
undoManager.on("change", function(e) {
var c = !undoManager.isAtBookmark();
if (changed !== c || undoManager.position == -1) {
changed = c;
emit("changed", { changed: c });
}
});
function initUndo(){
undoManager.on("change", function(e) {
var c = !undoManager.isAtBookmark();
if (changed !== c || undoManager.position == -1) {
changed = c;
emit("changed", { changed: c });
}
});
}
initUndo();
/***** Methods *****/
@ -401,6 +404,11 @@ define(function(require, module, exports) {
* @property {UndoManager} undoManager
*/
get undoManager(){ return undoManager; },
set undoManager(newUndo){
undoManager.unload();
undoManager = newUndo;
initUndo();
},
_events: [
/**

Wyświetl plik

@ -1,10 +1,16 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Test Runner</title>
<link rel="stylesheet" href="lib/mocha/mocha.css" />
<style> HTML { overflow: auto !important } </style>
<meta charset="utf-8">
<title>Test Runner</title>
<link rel="stylesheet" href="lib/mocha/mocha.css" />
<style>
HTML { overflow: auto !important }
body {
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 60px 50px;
}
</style>
</head>
<body>
<div id="mocha"></div>
@ -88,11 +94,17 @@
};
Storage.create(window, "localStorage");
Storage.create(window, "sessionStorage");
/*global Mocha, mocha*/
mocha.reporter(function(runner) {
Mocha.reporters.Base.call(this, runner);
Mocha.reporters.HTML.call(this, runner);
function extend(target, BaseFn, arg) {
var base = BaseFn.prototype;
for (var i in base) if (!target[i]) target[i] = base[i];
BaseFn.call(target, arg);
}
extend(this, Mocha.reporters.Base, runner);
extend(this, Mocha.reporters.HTML, runner);
var tests = [];
var stats = this.stats;

Wyświetl plik

@ -364,7 +364,8 @@ require([
})(),
util: {
alert: function() {},
escapeXml: function(s) { return s; }
escapeXml: function(s) { return s; },
stableStringify: function(s) { return JSON.stringify(s); },
},
gotoline: {
toggle: function(){ }

Wyświetl plik

@ -110,4 +110,3 @@ updateNodeModules
echo "Success!"
echo "run '${yellow}node server.js -p 8181 -l 0.0.0.0 -a :${resetColor}' to launch Cloud9"
"$NODE" server.js -p 8181 -l 0.0.0.0 -a :