mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
feature(edit) keep cursor on same position after remote patch
This commit is contained in:
parent
77ece7d6cb
commit
a516ee7b37
1 changed files with 7 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue