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

Function resetInput

GUI/codemirror/lib/codemirror.js:2304–2320  ·  view source on GitHub ↗
(cm, typing)

Source from the content-addressed store, hash-verified

2302 // Reset the input to correspond to the selection (or to be empty,
2303 // when not typing and nothing is selected)
2304 function resetInput(cm, typing) {
2305 var minimal, selected, doc = cm.doc;
2306 if (cm.somethingSelected()) {
2307 cm.display.prevInput = "";
2308 var range = doc.sel.primary();
2309 minimal = hasCopyEvent &&
2310 (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000);
2311 var content = minimal ? "-" : selected || cm.getSelection();
2312 cm.display.input.value = content;
2313 if (cm.state.focused) selectInput(cm.display.input);
2314 if (ie && !ie_upto8) cm.display.inputHasSelection = content;
2315 } else if (!typing) {
2316 cm.display.prevInput = cm.display.input.value = "";
2317 if (ie && !ie_upto8) cm.display.inputHasSelection = null;
2318 }
2319 cm.display.inaccurateSelection = minimal;
2320 }
2321
2322 function focusInput(cm) {
2323 if (cm.options.readOnly != "nocursor" && (!mobile || activeElt() != cm.display.input))

Callers 6

endOperationFunction · 0.85
readInputFunction · 0.85
onFocusFunction · 0.85
onContextMenuFunction · 0.85
pollFunction · 0.85
codemirror.jsFile · 0.85

Calls 1

selectInputFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…