保存时关标重置

This commit is contained in:
Liang Ding 2014-10-21 14:08:11 +08:00
parent d2b6d34c51
commit 420d1bd064
1 changed files with 6 additions and 2 deletions

View File

@ -411,6 +411,7 @@ var wide = {
if (!currentPath) { if (!currentPath) {
return false; return false;
} }
// 格式化后会对文件进行保存 // 格式化后会对文件进行保存
this.fmt(currentPath, wide.curEditor); this.fmt(currentPath, wide.curEditor);
}, },
@ -568,11 +569,13 @@ var wide = {
fmt: function (path, curEditor) { fmt: function (path, curEditor) {
var mode = curEditor.getOption("mode"); var mode = curEditor.getOption("mode");
var cursor = curEditor.getCursor();
var request = newWideRequest(); var request = newWideRequest();
request.file = path; request.file = path;
request.code = curEditor.getValue(); request.code = curEditor.getValue();
request.cursorLine = curEditor.getCursor().line; request.cursorLine = cursor.line;
request.cursorCh = curEditor.getCursor().ch; request.cursorCh = cursor.ch;
switch (mode) { switch (mode) {
case "text/x-go": // 会保存文件 case "text/x-go": // 会保存文件
@ -584,6 +587,7 @@ var wide = {
success: function (data) { success: function (data) {
if (data.succ) { if (data.succ) {
curEditor.setValue(data.code); curEditor.setValue(data.code);
curEditor.setCursor(cursor);
} }
} }
}); });