MCPcopy
hub / github.com/csev/py4e / unredoHelper

Function unredoHelper

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:851–865  ·  view source on GitHub ↗
(from, to)

Source from the content-addressed store, hash-verified

849 updateLinesNoUndo(from, to, newText, selFrom, selTo);
850 }
851 function unredoHelper(from, to) {
852 if (!from.length) return;
853 var set = from.pop(), out = [];
854 for (var i = set.length - 1; i >= 0; i -= 1) {
855 var change = set[i];
856 var replaced = [], end = change.start + change.added;
857 doc.iter(change.start, end, function(line) { replaced.push(line.text); });
858 out.push({start: change.start, added: change.old.length, old: replaced});
859 var pos = clipPos({line: change.start + change.old.length - 1,
860 ch: editEnd(replaced[replaced.length-1], change.old[change.old.length-1])});
861 updateLinesNoUndo({line: change.start, ch: 0}, {line: end - 1, ch: getLine(end-1).text.length}, change.old, pos, pos);
862 }
863 updateInput = true;
864 to.push(out);
865 }
866 function undo() {unredoHelper(history.done, history.undone);}
867 function redo() {unredoHelper(history.undone, history.done);}
868

Callers 2

undoFunction · 0.85
redoFunction · 0.85

Calls 4

editEndFunction · 0.85
updateLinesNoUndoFunction · 0.85
clipPosFunction · 0.70
getLineFunction · 0.70

Tested by

no test coverage detected