Fixed issue with F12 syncing

Activated the window before getting the text view for it, otherwise the
wrong document was being modified