Merge with upstream CodeMirror for #2696