MCPcopy Index your code
hub / github.com/csev/py4e / replaceSelection

Function replaceSelection

tools/pythonauto/static/codemirrorepl/codemirrorepl.js:1000–1006  ·  view source on GitHub ↗
(code, collapse)

Source from the content-addressed store, hash-verified

998 return end;
999 }
1000 function replaceSelection(code, collapse) {
1001 replaceRange1(splitLines(code), sel.from, sel.to, function(end) {
1002 if (collapse == "end") return {from: end, to: end};
1003 else if (collapse == "start") return {from: sel.from, to: sel.from};
1004 else return {from: sel.from, to: end};
1005 });
1006 }
1007 function replaceRange1(code, from, to, computeSel) {
1008 var endch = code.length == 1 ? code[0].length + from.ch : code[code.length-1].length;
1009 var newSel = computeSel({line: from.line + code.length - 1, ch: endch});

Callers 4

CodeMirrorFunction · 0.85
onDropFunction · 0.85
onKeyDownFunction · 0.85
readInputFunction · 0.85

Calls 1

replaceRange1Function · 0.85

Tested by

no test coverage detected