MCPcopy
hub / github.com/csev/py4e / resetInput

Function resetInput

tools/pythonauto/static/codemirrorepl/codemirror.js:2284–2300  ·  view source on GitHub ↗
(cm, typing)

Source from the content-addressed store, hash-verified

2282 // Reset the input to correspond to the selection (or to be empty,
2283 // when not typing and nothing is selected)
2284 function resetInput(cm, typing) {
2285 var minimal, selected, doc = cm.doc;
2286 if (cm.somethingSelected()) {
2287 cm.display.prevInput = "";
2288 var range = doc.sel.primary();
2289 minimal = hasCopyEvent &&
2290 (range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000);
2291 var content = minimal ? "-" : selected || cm.getSelection();
2292 cm.display.input.value = content;
2293 if (cm.state.focused) selectInput(cm.display.input);
2294 if (ie && !ie_upto8) cm.display.inputHasSelection = content;
2295 } else if (!typing) {
2296 cm.display.prevInput = cm.display.input.value = "";
2297 if (ie && !ie_upto8) cm.display.inputHasSelection = null;
2298 }
2299 cm.display.inaccurateSelection = minimal;
2300 }
2301
2302 function focusInput(cm) {
2303 if (cm.options.readOnly != "nocursor" && (!mobile || activeElt() != cm.display.input))

Callers 6

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

Calls 1

selectInputFunction · 0.70

Tested by

no test coverage detected