Attempt to improve how Fenrir reads multiple characters in a row, e.g. [------].

This commit is contained in:
Storm Dragon 2025-06-07 10:51:02 -04:00
parent ec6c135581
commit 7e87ebf04b

View File

@ -38,7 +38,7 @@ class textManager():
if name[0] == name[1]: if name[0] == name[1]:
newText += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' ' newText += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' '
else: else:
newText += ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name, True) + ' ' newText += ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[1], True) + ' '
lastPos = span[1] lastPos = span[1]
if lastPos != 0: if lastPos != 0:
newText += ' ' newText += ' '
@ -46,7 +46,7 @@ class textManager():
lastPos = 0 lastPos = 0
for match in self.regExSingle.finditer(newText): for match in self.regExSingle.finditer(newText):
span = match.span() span = match.span()
result += text[lastPos:span[0]] result += newText[lastPos:span[0]]
numberOfChars = len(newText[span[0]:span[1]]) numberOfChars = len(newText[span[0]:span[1]])
name = newText[span[0]:span[1]][:2] name = newText[span[0]:span[1]][:2]
if not self.env['runtime']['punctuationManager'].isPuctuation(name[0]): if not self.env['runtime']['punctuationManager'].isPuctuation(name[0]):
@ -55,7 +55,7 @@ class textManager():
if name[0] == name[1]: if name[0] == name[1]:
result += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' ' result += ' ' + str(numberOfChars) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' '
else: else:
result += ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name, True) + ' ' result += ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[0], True) + ' ' + str(int(numberOfChars / 2)) + ' ' + self.env['runtime']['punctuationManager'].proceedPunctuation(name[1], True) + ' '
lastPos = span[1] lastPos = span[1]
if lastPos != 0: if lastPos != 0:
result += ' ' result += ' '