[cmv4] Prevent modification of codemirror cursor position

Guard against modifying CodeMirror `getCursor()`, see https://github.com/marijnh/CodeMirror/issues/1966.

Fixes #6050, #6048, #6037, #6049, #6036