Do not move to end request when auto indenting

This commit is contained in:
Boaz Leskes 2014-02-11 10:33:46 +01:00
parent faed2ae390
commit 281bb79432

View file

@ -146,7 +146,13 @@ define([
editor.replaceRequestRange = function (newRequest, requestRange) {
var text = utils.textFromRequest(newRequest);
if (requestRange) {
var pos = editor.getCursorPosition();
editor.getSession().replace(requestRange, text);
var max_row = Math.max(requestRange.start.row + text.split('\n').length -1 , 0);
pos.row = Math.min(pos.row, max_row);
editor.moveCursorToPosition(pos);
// ACE UPGRADE - check if needed - at the moment the above may trigger a selection.
editor.clearSelection();
}
else {
// just insert where we are