MCPcopy Create free account
hub / github.com/breck7/scroll / prepareCopyCut

Function prepareCopyCut

external/.scrollLibs.js:12717–12739  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

12715 })
12716
12717 function prepareCopyCut(e) {
12718 if (signalDOMEvent(cm, e)) {
12719 return
12720 }
12721 if (cm.somethingSelected()) {
12722 setLastCopied({ lineWise: false, text: cm.getSelections() })
12723 } else if (!cm.options.lineWiseCopyCut) {
12724 return
12725 } else {
12726 var ranges = copyableRanges(cm)
12727 setLastCopied({ lineWise: true, text: ranges.text })
12728 if (e.type == "cut") {
12729 cm.setSelections(ranges.ranges, null, sel_dontScroll)
12730 } else {
12731 input.prevInput = ""
12732 te.value = ranges.text.join("\n")
12733 selectInput(te)
12734 }
12735 }
12736 if (e.type == "cut") {
12737 cm.state.cutIncoming = +new Date()
12738 }
12739 }
12740 on(te, "cut", prepareCopyCut)
12741 on(te, "copy", prepareCopyCut)
12742

Callers

nothing calls this directly

Calls 5

signalDOMEventFunction · 0.85
setLastCopiedFunction · 0.85
copyableRangesFunction · 0.85
selectInputFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected