This commit is contained in:
Liang Ding 2014-11-02 23:04:43 +08:00
parent 0fad1e3e34
commit 164e8cc345
2 changed files with 18 additions and 3 deletions

View File

@ -538,6 +538,7 @@ var editors = {
theme: 'wide',
indentUnit: 4,
foldGutter: true,
path: data.path,
extraKeys: {
"Ctrl-\\": "autocompleteAnyWord",
".": "autocompleteAfterDot",
@ -589,10 +590,20 @@ var editors = {
editor.on('changes', function (cm) {
if (cm.doc.isClean()) {
// 没有修改过
$(".edit-panel .tabs > div.current > span").removeClass("changed");
$(".edit-panel .tabs > div").each(function () {
var $span = $(this).find("span:eq(0)");
if ($span.attr("title") === cm.options.path) {
$span.removeClass("changed");
}
});
} else {
// 修改过
$(".edit-panel .tabs > div.current > span").addClass("changed");
$(".edit-panel .tabs > div").each(function () {
var $span = $(this).find("span:eq(0)");
if ($span.attr("title") === cm.options.path) {
$span.addClass("changed");
}
});
}
});

View File

@ -47,7 +47,7 @@ var session = {
// expand tree
for (var j = 0, jj = fileTree.length; j < jj; j++) {
if (nodes[i].path === fileTree[j]) {
tree.fileTree.expandNode(nodes[i], true, false, false);
tree.fileTree.expandNode(nodes[i], true, false, true);
break;
}
}
@ -62,6 +62,10 @@ var session = {
if (nodes[i].path === currentFile) {
id = nodes[i].tId;
// FIXME: 上面的展开是异步进行的,所以执行到这里的时候可能还没有展开完,导致定位不了可视区域
tree.fileTree.selectNode(nodes[i]);
wide.curNode = nodes[i];
}
}