Revert Qt regex and use UTF-16 to UCS-4 index map for all highlighting

This commit is contained in:
Veronica Berglyd Olsen
2025-07-05 15:53:34 +02:00
parent 8067acdc1c
commit c12a864e8a
2 changed files with 120 additions and 118 deletions
+2 -6
View File
@@ -27,7 +27,7 @@ from __future__ import annotations
import re
from novelwriter import CONFIG
from novelwriter.common import compact, uniqueCompact, utf16CharMap
from novelwriter.common import compact, uniqueCompact
from novelwriter.constants import nwRegEx, nwUnicode
@@ -176,7 +176,7 @@ class DialogParser:
return
def __call__(self, text: str, wideChar: bool = False) -> list[tuple[int, int]]:
def __call__(self, text: str) -> list[tuple[int, int]]:
"""Caller wrapper for dialogue processing."""
temp: list[int] = []
result: list[tuple[int, int]] = []
@@ -224,8 +224,4 @@ class DialogParser:
result.append((start, pos))
start = None
if wideChar:
posMap = utf16CharMap(text)
result = [(posMap[s], posMap[p]) for s, p in result]
return result