marijnh/CodeMirror — pull request #1094 by njx (2012-12-18 02:01:18+00:00)
Title: Restore focus to line widget if it was focused before line was edited

In Brackets, a number of our line widgets have children that can take focus (e.g. nested CodeMirror editors or UIs that have text input controls). If an edit is made in the parent editor to the line that the widget is attached to, `buildLineElement()` is called to rebuild the line. As part of this, the widget is temporarily removed from and then readded to the DOM, which causes it to lose focus.

This patch checks to see if the previously focused element is still a child of the rebuilt line, and if so, restores focus to it.