Fix "switch mode" to edit current code in new mode when compatible.