Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ define(function (require, exports, module) {
* @param {!string} timingFunctionString
*/
InlineTimingFunctionEditor.prototype._handleTimingFunctionChange = function (timingFunctionString) {
var timingFunctionMatch = TimingFunctionUtils.timingFunctionMatch(timingFunctionString, true);
var self = this,
timingFunctionMatch = TimingFunctionUtils.timingFunctionMatch(timingFunctionString, true);
if (timingFunctionMatch !== this._timingFunction) {
var range = this.getCurrentRange();
if (!range) {
Expand All @@ -165,12 +166,14 @@ define(function (require, exports, module) {

// Don't push the change back into the host editor if it came from the host editor.
if (!this._isHostChange) {
// Replace old timingFunction in code with the editor's timing function, and select it
this._isOwnChange = true;
this.hostEditor.document.replaceRange(timingFunctionString, range.start, range.end, this._origin);
this.hostEditor.document.batchOperation(function () {
// Replace old timingFunction in code with the editor's timing function, and select it
self.hostEditor.document.replaceRange(timingFunctionString, range.start, range.end, self._origin);
var newEnd = { line: range.start.line, ch: range.start.ch + timingFunctionString.length };
self.hostEditor.setSelection(range.start, newEnd, false, 0, self._origin);
});
this._isOwnChange = false;
var newEnd = { line: range.start.line, ch: range.start.ch + timingFunctionString.length };
this.hostEditor.setSelection(range.start, newEnd, false, 0, this._origin);
}

this._timingFunction = timingFunctionMatch;
Expand Down