Fix a new cursor error with Codepad

pull/1/head
Yann Flory 9 years ago
parent c2e0dded3a
commit 360fee9feb

@ -173,8 +173,8 @@ define([
newCursor.ch = removedTextColumnIndex; newCursor.ch = removedTextColumnIndex;
} }
} }
else if(cursor.line === removedTextLineNumber && cursor.ch > removedTextLineNumber) { else if(cursor.line === removedTextLineNumber && cursor.ch > removedTextColumnIndex) {
newCursor.ch -= Math.min(length, cursor.ch-removedTextLineNumber); newCursor.ch -= Math.min(length, cursor.ch-removedTextColumnIndex);
} }
return newCursor; return newCursor;
}; };
@ -327,7 +327,8 @@ define([
var oldCursorCMEnd = cmEditor.getCursor('to'); var oldCursorCMEnd = cmEditor.getCursor('to');
var newCursor; var newCursor;
var newSelection; var newSelection;
if(oldCursorCMStart !== oldCursorCMEnd) { // Selection if(oldCursorCMStart.line !== oldCursorCMEnd.line
&& oldCursorCMStart.ch !== oldCursorCMEnd.ch) { // Selection
if (op.toRemove > 0) { if (op.toRemove > 0) {
newSelection = [transformCursorCMRemove(oldValue, oldCursorCMStart, op.offset, op.toRemove), transformCursorCMRemove(oldValue, oldCursorCMEnd, op.offset, op.toRemove)]; newSelection = [transformCursorCMRemove(oldValue, oldCursorCMStart, op.offset, op.toRemove), transformCursorCMRemove(oldValue, oldCursorCMEnd, op.offset, op.toRemove)];
} }

Loading…
Cancel
Save