MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / kill

Function kill

lib/web/kill.js:26–41  ·  view source on GitHub ↗
(cm, from, to, mayGrow, text)

Source from the content-addressed store, hash-verified

24var lastKill = null;
25
26function kill(cm, from, to, mayGrow, text) {
27 if (text == null) text = cm.getRange(from, to);
28
29 if (mayGrow && lastKill && lastKill.cm == cm && posEq(from, lastKill.pos) && cm.isClean(lastKill.gen))
30 growRingTop(text);
31 else
32 addToRing(text);
33 cm.replaceRange("", from, to, "+delete");
34
35 if (mayGrow) lastKill = {
36 cm: cm,
37 pos: from,
38 gen: cm.changeGeneration()
39 };
40 else lastKill = null;
41}
42
43function copy() {
44 console.log("COPY");

Callers 1

cutFunction · 0.70

Calls 5

replaceRangeMethod · 0.80
growRingTopFunction · 0.70
addToRingFunction · 0.70
posEqFunction · 0.50
getRangeMethod · 0.45

Tested by

no test coverage detected