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

Function getRange

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

Source from the content-addressed store, hash-verified

1011 }
1012
1013 function getRange(from, to) {
1014 var l1 = from.line, l2 = to.line;
1015 if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);
1016 var code = [getLine(l1).text.slice(from.ch)];
1017 doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
1018 code.push(getLine(l2).text.slice(0, to.ch));
1019 return code.join("\n");
1020 }
1021 function getSelection() {
1022 return getRange(sel.from, sel.to);
1023 }

Callers 2

CodeMirrorFunction · 0.85
getSelectionFunction · 0.85

Calls 2

sliceMethod · 0.80
getLineFunction · 0.70

Tested by

no test coverage detected