Apply patch for updateSelection

From https://github.com/marijnh/CodeMirror/pull/2725