@@ -790,7 +790,7 @@ var CodeMirror = (function() {
790790 // Uses a set of changes plus the current scroll position to
791791 // determine which DOM updates have to be made, and makes the
792792 // updates.
793- function updateDisplay ( changes ) {
793+ function updateDisplay ( changes , suppressCallback ) {
794794 if ( ! scroller . clientWidth ) {
795795 showingFrom = showingTo = displayOffset = 0 ;
796796 return ;
@@ -865,6 +865,8 @@ var CodeMirror = (function() {
865865 gutter . style . display = gutterDisplay ;
866866 if ( different || gutterDirty ) updateGutter ( ) ;
867867 updateCursor ( ) ;
868+ if ( ! suppressCallback && options . onUpdate ) options . onUpdate ( instance ) ;
869+ return true ;
868870 }
869871
870872 function computeIntact ( intact , changes ) {
@@ -1650,9 +1652,9 @@ var CodeMirror = (function() {
16501652 changes = [ ] ; selectionChanged = false ; callbacks = [ ] ;
16511653 }
16521654 function endOperation ( ) {
1653- var reScroll = false ;
1655+ var reScroll = false , updated ;
16541656 if ( selectionChanged ) reScroll = ! scrollCursorIntoView ( ) ;
1655- if ( changes . length ) updateDisplay ( changes ) ;
1657+ if ( changes . length ) updated = updateDisplay ( changes , true ) ;
16561658 else {
16571659 if ( selectionChanged ) updateCursor ( ) ;
16581660 if ( gutterDirty ) updateGutter ( ) ;
@@ -1675,6 +1677,7 @@ var CodeMirror = (function() {
16751677 if ( tc && options . onChange && instance )
16761678 options . onChange ( instance , tc ) ;
16771679 for ( var i = 0 ; i < cbs . length ; ++ i ) cbs [ i ] ( instance ) ;
1680+ if ( updated && options . onUpdate ) options . onUpdate ( instance ) ;
16781681 }
16791682 var nestedOperation = 0 ;
16801683 function operation ( f ) {
0 commit comments