From d84088711ca6bf9f08076276937a97dafb48b4ef Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sat, 1 Jul 2023 15:26:11 +0200 Subject: [PATCH] fix: map highlighting changes --- packages/react/src/components/CodeMirror6.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react/src/components/CodeMirror6.jsx b/packages/react/src/components/CodeMirror6.jsx index fe538019c..cb1889358 100644 --- a/packages/react/src/components/CodeMirror6.jsx +++ b/packages/react/src/components/CodeMirror6.jsx @@ -50,6 +50,9 @@ const highlightField = StateField.define({ return Decoration.none; }, update(highlights, tr) { + // proper fix for https://github.com/tidalcycles/strudel/issues/178 + // see https://discuss.codemirror.net/t/uncatchable-out-of-range-errors-when-document-changes/4864/5 + highlights = highlights.map(tr.changes); try { for (let e of tr.effects) { if (e.is(setHighlights)) {