MCPcopy
hub / github.com/witheve/Eve / prepareCopyCut

Function prepareCopyCut

src/codemirror.js:1264–1288  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1262 });
1263
1264 function prepareCopyCut(e) {
1265 if (signalDOMEvent(cm, e)) return
1266 if (cm.somethingSelected()) {
1267 lastCopied = {lineWise: false, text: cm.getSelections()};
1268 if (input.inaccurateSelection) {
1269 input.prevInput = "";
1270 input.inaccurateSelection = false;
1271 te.value = lastCopied.text.join("\n");
1272 selectInput(te);
1273 }
1274 } else if (!cm.options.lineWiseCopyCut) {
1275 return;
1276 } else {
1277 var ranges = copyableRanges(cm);
1278 lastCopied = {lineWise: true, text: ranges.text};
1279 if (e.type == "cut") {
1280 cm.setSelections(ranges.ranges, null, sel_dontScroll);
1281 } else {
1282 input.prevInput = "";
1283 te.value = ranges.text.join("\n");
1284 selectInput(te);
1285 }
1286 }
1287 if (e.type == "cut") cm.state.cutIncoming = true;
1288 }
1289 on(te, "cut", prepareCopyCut);
1290 on(te, "copy", prepareCopyCut);
1291

Callers

nothing calls this directly

Calls 4

signalDOMEventFunction · 0.85
selectInputFunction · 0.85
copyableRangesFunction · 0.85
somethingSelectedMethod · 0.80

Tested by

no test coverage detected