Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Code review fix: focusedEditorChange was passing wrong last arg to its
Browse files Browse the repository at this point in the history
listeners.
And add a couple more docs.
  • Loading branch information
peterflynn committed Oct 18, 2012
1 parent 4a34b88 commit 9a2c59c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ define(function (require, exports, module) {

this._codeMirror.setOption("onBlur", function () {
self._focused = false;
// EditorManager only cares about other Editors gaining focus, so we don't notify it of anything here
});
};

Expand Down
4 changes: 3 additions & 1 deletion src/editor/EditorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,18 @@ define(function (require, exports, module) {

/**
* @private
* @param {?Editor} current
*/
function _notifyFocusedEditorChanged(current) {
// Skip if the Editor that gained focus was already the most recently focused editor.
// This may happen e.g. if the window loses then regains focus.
if (_lastFocusedEditor === current) {
return;
}
var previous = _lastFocusedEditor;
_lastFocusedEditor = current;

$(exports).triggerHandler("focusedEditorChange", [current, _lastFocusedEditor]);
$(exports).triggerHandler("focusedEditorChange", [current, previous]);
}

/**
Expand Down

0 comments on commit 9a2c59c

Please sign in to comment.