From 9a2c59c52c272b709e10b3103ce79f88ee6a7d18 Mon Sep 17 00:00:00 2001 From: Peter Flynn Date: Thu, 18 Oct 2012 10:52:53 -0700 Subject: [PATCH] Code review fix: focusedEditorChange was passing wrong last arg to its listeners. And add a couple more docs. --- src/editor/Editor.js | 1 + src/editor/EditorManager.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/editor/Editor.js b/src/editor/Editor.js index 60db8ab3164..e4c1c189688 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -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 }); }; diff --git a/src/editor/EditorManager.js b/src/editor/EditorManager.js index 2068fe3e05a..cad78b89af6 100644 --- a/src/editor/EditorManager.js +++ b/src/editor/EditorManager.js @@ -380,6 +380,7 @@ 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. @@ -387,9 +388,10 @@ define(function (require, exports, module) { if (_lastFocusedEditor === current) { return; } + var previous = _lastFocusedEditor; _lastFocusedEditor = current; - $(exports).triggerHandler("focusedEditorChange", [current, _lastFocusedEditor]); + $(exports).triggerHandler("focusedEditorChange", [current, previous]); } /**