Commit 14dec2b6 for codemirror.net
commit 14dec2b6e79899914bd94a679d6561915d34d3ad
Author: Marijn Haverbeke <marijn@haverbeke.nl>
Date: Tue Jan 12 10:38:25 2021 +0100
Don't scroll the selection into view in nocursor mode
Closes #6561
diff --git a/src/model/selection_updates.js b/src/model/selection_updates.js
index 4db2bd7f..3f399e5f 100644
--- a/src/model/selection_updates.js
+++ b/src/model/selection_updates.js
@@ -106,7 +106,7 @@ export function setSelectionNoUndo(doc, sel, options) {
(cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1)
setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true))
- if (!(options && options.scroll === false) && doc.cm)
+ if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption("readOnly") != "nocursor")
ensureCursorVisible(doc.cm)
}