diff --git a/editor/src/main/java/io/github/rosemoe/sora/widget/SymbolPairMatch.java b/editor/src/main/java/io/github/rosemoe/sora/widget/SymbolPairMatch.java index c453cdda6..dcb5b6d26 100644 --- a/editor/src/main/java/io/github/rosemoe/sora/widget/SymbolPairMatch.java +++ b/editor/src/main/java/io/github/rosemoe/sora/widget/SymbolPairMatch.java @@ -89,7 +89,7 @@ public void putPair(char[] charArray, SymbolPair symbolPair) { } list.add(symbolPair); - multipleCharByEndPairMaps.put(endChar, list); + multipleCharByEndPairMaps.put(charArray[charArray.length - 1], list); } /** diff --git a/language-textmate/src/main/java/io/github/rosemoe/sora/langs/textmate/TextMateSymbolPairMatch.java b/language-textmate/src/main/java/io/github/rosemoe/sora/langs/textmate/TextMateSymbolPairMatch.java index 59ab8b10f..ae0a21388 100644 --- a/language-textmate/src/main/java/io/github/rosemoe/sora/langs/textmate/TextMateSymbolPairMatch.java +++ b/language-textmate/src/main/java/io/github/rosemoe/sora/langs/textmate/TextMateSymbolPairMatch.java @@ -95,6 +95,19 @@ public void updatePair() { var newPair = new AutoClosingPairConditional(surroundingPair.open, surroundingPair.close, surroundingPairFlagWithList); + var mergePairIndex = mergePairs.indexOf(newPair); + + if (mergePairIndex >= 0) { + var mergePair = mergePairs.get(mergePairIndex); + + if (mergePair.notIn == null || mergePair.notIn.isEmpty()) { + mergePairs.add(newPair); + continue; + } + + mergePair.notIn.add(surroundingPairFlag); + + } mergePairs.add(newPair); } }