Half doc glitch

Setting document value, then mode should improve rendering speeds, and initiallizing CodeMirror before the ajax callback will ensure there is content to look at during transition.

Hit testing might be wanted.