From ddebacc5f23a9baffbcb0e16e9c7af86a5537375 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 10 Nov 2023 08:19:31 +0100 Subject: [PATCH] Fix patch for supporting type-over closed brackets on new lines FIX: Fix a bug that caused typing over closed brackets after pressing enter to still not work in many situations. See https://discuss.codemirror.net/t/closebrackets-across-multiple-lines/7392/4 --- src/closebrackets.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/closebrackets.ts b/src/closebrackets.ts index d6bb29a..8d40800 100644 --- a/src/closebrackets.ts +++ b/src/closebrackets.ts @@ -41,11 +41,11 @@ closedBracket.startSide = 1; closedBracket.endSide = -1 const bracketState = StateField.define>({ create() { return RangeSet.empty }, update(value, tr) { + value = value.map(tr.changes) if (tr.selection) { let line = tr.state.doc.lineAt(tr.selection.main.head) value = value.update({filter: from => from >= line.from && from <= line.to}) } - value = value.map(tr.changes) for (let effect of tr.effects) if (effect.is(closeBracketEffect)) value = value.update({add: [closedBracket.range(effect.value, effect.value + 1)]}) return value