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