MCPcopy
hub / github.com/hokein/electron-sample-apps / getRange

Function getRange

mini-code-editor/cm/lib/codemirror.js:813–820  ·  view source on GitHub ↗
(from, to)

Source from the content-addressed store, hash-verified

811 }
812
813 function getRange(from, to) {
814 var l1 = from.line, l2 = to.line;
815 if (l1 == l2) return getLine(l1).text.slice(from.ch, to.ch);
816 var code = [getLine(l1).text.slice(from.ch)];
817 doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
818 code.push(getLine(l2).text.slice(0, to.ch));
819 return code.join("\n");
820 }
821 function getSelection() {
822 return getRange(sel.from, sel.to);
823 }

Callers 2

CodeMirrorFunction · 0.85
getSelectionFunction · 0.85

Calls 1

getLineFunction · 0.85

Tested by

no test coverage detected