diff --git a/lib/client/edit.js b/lib/client/edit.js index f16367e8..bdd71634 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -89,12 +89,17 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, DiffProto, diff_match_patch, Zip, M Util.log(error); } else { sha(function(error, hash) { - var value; + var value, cursor; if (hash === hashFS) { value = Edit.getValue(); value = Diff.applyPatch(value, data); - Edit.setValue(value); + cursor = Ace.selection.getCursor(); + + Ace.setValue(value); + Ace.clearSelection(); + Ace.moveCursorTo(cursor.row, cursor.column); + Ace.scrollToLine(cursor.row, true); } }); }