@@ -156,7 +156,8 @@ define(function (require, exports, module) {
156156 * @param {!string } timingFunctionString
157157 */
158158 InlineTimingFunctionEditor . prototype . _handleTimingFunctionChange = function ( timingFunctionString ) {
159- var timingFunctionMatch = TimingFunctionUtils . timingFunctionMatch ( timingFunctionString , true ) ;
159+ var self = this ,
160+ timingFunctionMatch = TimingFunctionUtils . timingFunctionMatch ( timingFunctionString , true ) ;
160161 if ( timingFunctionMatch !== this . _timingFunction ) {
161162 var range = this . getCurrentRange ( ) ;
162163 if ( ! range ) {
@@ -165,12 +166,14 @@ define(function (require, exports, module) {
165166
166167 // Don't push the change back into the host editor if it came from the host editor.
167168 if ( ! this . _isHostChange ) {
168- // Replace old timingFunction in code with the editor's timing function, and select it
169169 this . _isOwnChange = true ;
170- this . hostEditor . document . replaceRange ( timingFunctionString , range . start , range . end , this . _origin ) ;
170+ this . hostEditor . document . batchOperation ( function ( ) {
171+ // Replace old timingFunction in code with the editor's timing function, and select it
172+ self . hostEditor . document . replaceRange ( timingFunctionString , range . start , range . end , self . _origin ) ;
173+ var newEnd = { line : range . start . line , ch : range . start . ch + timingFunctionString . length } ;
174+ self . hostEditor . setSelection ( range . start , newEnd , false , 0 , self . _origin ) ;
175+ } ) ;
171176 this . _isOwnChange = false ;
172- var newEnd = { line : range . start . line , ch : range . start . ch + timingFunctionString . length } ;
173- this . hostEditor . setSelection ( range . start , newEnd , false , 0 , this . _origin ) ;
174177 }
175178
176179 this . _timingFunction = timingFunctionMatch ;
0 commit comments