()
| 2062 | changes = []; selectionChanged = false; callbacks = []; |
| 2063 | } |
| 2064 | function endOperation() { |
| 2065 | var reScroll = false, updated; |
| 2066 | if (maxLengthChanged) computeMaxLength(); |
| 2067 | if (selectionChanged) reScroll = !scrollCursorIntoView(); |
| 2068 | if (changes.length) updated = updateDisplay(changes, true); |
| 2069 | else { |
| 2070 | if (selectionChanged) updateSelection(); |
| 2071 | if (gutterDirty) updateGutter(); |
| 2072 | } |
| 2073 | if (reScroll) scrollCursorIntoView(); |
| 2074 | if (selectionChanged) {scrollEditorIntoView(); restartBlink();} |
| 2075 | |
| 2076 | if (focused && !leaveInputAlone && |
| 2077 | (updateInput === true || (updateInput !== false && selectionChanged))) |
| 2078 | resetInput(userSelChange); |
| 2079 | |
| 2080 | if (selectionChanged && options.matchBrackets) |
| 2081 | setTimeout(operation(function() { |
| 2082 | if (bracketHighlighted) {bracketHighlighted(); bracketHighlighted = null;} |
| 2083 | if (posEq(sel.from, sel.to)) matchBrackets(false); |
| 2084 | }), 20); |
| 2085 | var tc = textChanged, cbs = callbacks; // these can be reset by callbacks |
| 2086 | if (selectionChanged && options.onCursorActivity) |
| 2087 | options.onCursorActivity(instance); |
| 2088 | if (tc && options.onChange && instance) |
| 2089 | options.onChange(instance, tc); |
| 2090 | for (var i = 0; i < cbs.length; ++i) cbs[i](instance); |
| 2091 | if (updated && options.onUpdate) options.onUpdate(instance); |
| 2092 | } |
| 2093 | var nestedOperation = 0; |
| 2094 | function operation(f) { |
| 2095 | return function() { |
no test coverage detected