adobe/brackets — pull request #1877 by peterflynn (2012-10-18 06:02:19+00:00)
Title: Safer focusedEditorChanged event:

Make editor-swapping more independent from the focusedEditorChanged event, and make the event to fire more consistently.

This fixes the scrolling issue Randy reported in #1864. I think it also fixes all the cases listed in #1860, and it further improves upon #1257 to the point where it's _almost_ fixed.

Code changes:

* Revert main-editor-swapping codepath back to how it used to work, mostly disentangled from focus events.
* Don't fire focusedEditorChanged on the many times focus returns to the same Editor that had it last (due to window reactivation, closing a dialog, closing a search bar, etc.). All the current use cases for this event don't care about those cases. Add more detailed docs on event cases.
* Simplify how Editor signals focus: trigger only from "onFocus" (a superset of the other case), and remove _internalFocus flag that was guarding against the overlap.
* Don't call resizeEditor() on every editor swap just because statusbar *might* have been shown/hidden: only call when statusbar actually did change (going to/from no editor). (Required to fix scrolling issue in #1864).