fix: highlight colors when multiple list have different configurations

This commit is contained in:
2025-10-29 12:29:55 +03:00
parent 326e585021
commit 67577c89cf

View File

@@ -41,7 +41,7 @@ export class HighlightEngine {
} }
} }
private updateWordStyles(activeWords: ActiveWord[]): void { private updateWordStyles(activeWords: ActiveWord[], matchCase: boolean): void {
this.initializeStyleSheet(); this.initializeStyleSheet();
while (this.styleSheet!.cssRules.length > 0) { while (this.styleSheet!.cssRules.length > 0) {
@@ -61,7 +61,7 @@ export class HighlightEngine {
this.styleSheet!.insertRule(rule, this.styleSheet!.cssRules.length); this.styleSheet!.insertRule(rule, this.styleSheet!.cssRules.length);
} }
const lookup = word.text; const lookup = matchCase ? word.text : word.text.toLowerCase();
this.wordStyleMap.set(lookup, uniqueStyles.get(styleKey)!); this.wordStyleMap.set(lookup, uniqueStyles.get(styleKey)!);
} }
} }
@@ -129,7 +129,7 @@ export class HighlightEngine {
return; return;
} }
this.updateWordStyles(activeWords); this.updateWordStyles(activeWords, matchCase);
const wordMap = new Map<string, ActiveWord>(); const wordMap = new Map<string, ActiveWord>();
for (const word of activeWords) { for (const word of activeWords) {