(cm, typing)
| 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)) |
no test coverage detected
searching dependent graphs…