fix small regressions caused by ace update

This commit is contained in:
nightwing 2018-06-28 00:31:24 +04:00
parent e5274f29a2
commit d8917f33fd
10 changed files with 57 additions and 36 deletions

View File

@ -89,6 +89,7 @@ define(function(require, exports, module) {
minLines: 2,
fontFamily: "inherit"
});
chatInput.ace.session.$enableVarChar = true;
chatInput.ace.session.$setFontMetrics(chatInput.ace.renderer.$fontMetrics);
plugin.addElement(chatInput);

View File

@ -143,6 +143,10 @@
.ace_lineWidgetContainer:after{
background: transparent;
}
.ace_lineWidgetContainer {
z-index: 5;
position: absolute;
}
/* ace_dark */

View File

@ -483,7 +483,7 @@ define(function(require, exports, module) {
return callback();
anims.animateSplitBoxNode(amlNode, {
height: amlNode.$ext.scrollHeight + "px",
height: amlNode.$ext.offsetHeight + "px",
duration: 0.2,
timingFunction: "cubic-bezier(.10, .10, .25, .90)"
}, function() {

View File

@ -39,7 +39,7 @@ define(function(require, exports, module) {
var sources = [];
var frames = [];
var activeFrame, dbg, menu, button, lastException;
var activeFrame, dbg, menu, button, lastException, sourceListTimer;
var loaded = false;
function load() {
@ -578,7 +578,7 @@ define(function(require, exports, module) {
function loadSources(input) {
sources = input;
modelSources.setRoot(sources);
updateSourceTree();
}
function clearFrames() {
@ -587,7 +587,15 @@ define(function(require, exports, module) {
function addSource(source) {
sources.push(source);
modelSources.setRoot(sources);
updateSourceTree();
}
function updateSourceTree() {
if (sourceListTimer) return;
sourceListTimer = setTimeout(function() {
sourceListTimer = null;
modelSources.setRoot(sources);
}, 100);
}
function updateAll() {

View File

@ -100,6 +100,8 @@ define(function(require, exports, module) {
updateAll();
});
debug.on("exception", function(e) {
if (errorWatch)
removeWatch(errorWatch);
errorWatch = e.exception;
addWatch(errorWatch);
model.expand(errorWatch);

View File

@ -103,4 +103,8 @@
.c9terminalcontainer .cover-link:hover {
opacity: 1;
text-decoration: underline;
}
}
.terminal > .ace_line {
contain: style size layout!important;
}

View File

@ -668,13 +668,12 @@ define(function(require, exports, module) {
var screenBottom = config.height - coverHeight + config.offset + 2;
var screenRight = (cols - this.width) * config.characterWidth;
html.push("<div style='height:", coverHeight, "px;", "left:0; right: ", screenRight, "px; top:", screenBottom, "px;' ",
"class='c9terminalcontainer cover bottom'></div>",
"<div style='width:", screenRight, "px; height: ", screenBottom, "px; top:0; right:0;' ",
"class='c9terminalcontainer cover right'></div>",
"<div style='width:", screenRight, "px; bottom:0; top:", screenBottom, "px; right:0;' ",
"class='c9terminalcontainer cover'></div>"
);
markerLayer.elt("c9terminalcontainer cover bottom",
"height:" + coverHeight + "px;" + "left:0; right: " + screenRight + "px; top:" + screenBottom + "px;");
markerLayer.elt("c9terminalcontainer cover right",
"width:" + screenRight + "px; height: " + screenBottom + "px; top:0; right:0;");
markerLayer.elt("c9terminalcontainer cover",
"width:" + screenRight + "px; bottom:0; top:" + screenBottom + "px; right:0;");
};
aceSession.addDynamicMarker(marker, true);
aceSession.term.tmuxDotCover = marker;

View File

@ -227,7 +227,7 @@ function plugin(options, imports, register) {
var base = __dirname + "/../../";
var blacklistfile = base + "/test/blacklist.txt";
var filefinder = require(base + "/test/lib/filefinder.js");
filefinder.find(base, "plugins", ".*_test.js", blacklistfile, function(err, result) {
filefinder.find(base, "plugins", ".*_test.(js|ts)", blacklistfile, function(err, result) {
result.all = result.list.concat(result.blacklist);
async.filterSeries(result.list, function(path, next) {
fs.readFile(base + path, "utf8", function(err, file) {

View File

@ -145,7 +145,7 @@ var EditableTree = function(tree) {
tree.renderer.fontMetrics = new FontMetrics(tree.renderer.container);
}
tree.renderer.fontMetrics.checkForSizeChanges();
editor.session.$enableVarChar = true;
editor.session.$setFontMetrics(tree.renderer.fontMetrics);
return editor;

View File

@ -10,19 +10,7 @@ exports.transform = function(code, options) {
code = "define(function(require, exports, module) {" + code + "\n})";
}
if (options.mode == "babel") {
var babel = require("babel");
return babel.transform(code, {
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "ie >= 11"]
}
}]
]
}).code;
}
else if (options.mode == "ts" || options.mode == "es5") {
if (options.mode == "ts" || options.mode == "es5") {
var ts = require("typescript");
return ts.transpileModule(code, {
compilerOptions: {
@ -30,13 +18,13 @@ exports.transform = function(code, options) {
suppressExcessPropertyErrors: true,
removeComments: true,
newLine: "lf",
module: ts.ModuleKind.CommonJS
}
module: ts.ModuleKind.CommonJS,
sourceMap: !!options.srcPath,
inlineSourceMap: true
},
fileName: options.srcPath
}).outputText;
}
else if (options.mode == "buble") {
return require("buble").transform(code).code;
}
return code;
};
@ -47,14 +35,28 @@ exports.sendFile = function(req, res, next) {
var transform = req.params.transform;
var filePath = moduleDeps.resolveModulePath(path, req.pathConfig.pathMap);
if (!/\.js$/.test(filePath) || /(browserified|\.min|test\d)\.js$/.test(filePath)) {
if (!/\.(js|ts)$/.test(filePath) || /(browserified|\.min|test\d)\.js$/.test(filePath)) {
return send(req, filePath.substr(req.pathConfig.root.length))
.root(req.pathConfig.root)
.on('error', next)
.pipe(res);
}
fs.stat(filePath, function(err, stat) {
function resolvePath(callback) {
fs.stat(filePath, function(err, stat) {
if (err && err.code == "ENOENT") {
var tsPath = filePath.replace(/\.js$/, ".ts");
if (tsPath != filePath) {
return fs.stat(tsPath, function(err, stat) {
callback(err, stat, tsPath);
});
}
}
callback(err, stat);
});
}
resolvePath(function(err, stat, srcPath) {
if (err) return next(err);
var mtime = stat.mtime.valueOf();
var etag = 'W/"' + stat.size.toString(16) + "-" + mtime.toString(16) + '"';
@ -72,15 +74,16 @@ exports.sendFile = function(req, res, next) {
return sendResponse(cache[key].value);
res.setHeader("ETag", etag);
cache[key] = null;
fs.readFile(filePath, "utf8", function(err, value) {
fs.readFile(srcPath || filePath, "utf8", function(err, value) {
if (err)
return next(err);
var t = Date.now();
try {
value = exports.transform(value, {
path: filePath,
mode: transform,
mode: srcPath ? "ts" : transform,
amd: true,
srcPath: srcPath ? path.replace(/\.js/, ".ts") : ""
});
} catch (e) {
return next(e);