MCPcopy Create free account
hub / github.com/sql-js/sql.js / prepareCopyCut

Function prepareCopyCut

GUI/codemirror/lib/codemirror.js:2449–2474  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

2447 });
2448
2449 function prepareCopyCut(e) {
2450 if (cm.somethingSelected()) {
2451 if (d.inaccurateSelection) {
2452 d.prevInput = "";
2453 d.inaccurateSelection = false;
2454 d.input.value = cm.getSelection();
2455 selectInput(d.input);
2456 }
2457 } else {
2458 var text = "", ranges = [];
2459 for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
2460 var line = cm.doc.sel.ranges[i].head.line;
2461 var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
2462 ranges.push(lineRange);
2463 text += cm.getRange(lineRange.anchor, lineRange.head);
2464 }
2465 if (e.type == "cut") {
2466 cm.setSelections(ranges, null, sel_dontScroll);
2467 } else {
2468 d.prevInput = "";
2469 d.input.value = text;
2470 selectInput(d.input);
2471 }
2472 }
2473 if (e.type == "cut") cm.state.cutIncoming = true;
2474 }
2475 on(d.input, "cut", prepareCopyCut);
2476 on(d.input, "copy", prepareCopyCut);
2477

Callers

nothing calls this directly

Calls 1

selectInputFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…