Refactored handle_codemirror_keyevent to make it easier to monkeypatch.
Also return null for cases where I want to defer control