From 1976dd0e10c1bfb79761044198d642f2517c05e0 Mon Sep 17 00:00:00 2001 From: tristan Date: Tue, 12 Mar 2024 17:24:46 +0100 Subject: [PATCH] test: added additional test which was breaking --- pkg/twmerge/modifier-utils.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/twmerge/modifier-utils.go b/pkg/twmerge/modifier-utils.go index 315eabf..884799b 100644 --- a/pkg/twmerge/modifier-utils.go +++ b/pkg/twmerge/modifier-utils.go @@ -46,6 +46,11 @@ func MakeSplitModifiers(conf *TwMergeConfig) SplitModifiersFn { baseClass = baseClassWithImportant } + // fix case where there is modifier & maybePostfix which causes maybePostfix to be beyond size of baseClass + if maybePostfixModPosition != -1 && maybePostfixModPosition > modifierStart { + maybePostfixModPosition -= modifierStart + } + return baseClass, modifiers, hasImportant, maybePostfixModPosition }