@@ -499,20 +499,20 @@ def update(self):
499499 mode |= louis .compbrlAtCursor
500500
501501 converter : UnicodeNormalizationOffsetConverter | None = None
502- if config .conf ["braille" ]["unicodeNormalization" ] and not isUnicodeNormalized (self .rawText ):
503- converter = UnicodeNormalizationOffsetConverter (self .rawText )
502+ textToTranslate = self .rawText
503+ textToTranslateTypeforms = self .rawTextTypeforms
504+ cursorPos = self .cursorPos
505+ if config .conf ["braille" ]["unicodeNormalization" ] and not isUnicodeNormalized (textToTranslate ):
506+ converter = UnicodeNormalizationOffsetConverter (textToTranslate )
504507 textToTranslate = converter .encoded
505- # Typeforms must be adapted to represent normalized characters.
506- textToTranslateTypeforms = [
507- self .rawTextTypeforms [strOffset ] for strOffset in converter .computedEncodedToStrOffsets
508- ]
509- # Convert the cursor position to a normalized offset.
510- cursorPos = converter .strToEncodedOffsets (self .cursorPos )
511- else :
512- textToTranslate = self .rawText
513- textToTranslateTypeforms = self .rawTextTypeforms
514- cursorPos = self .cursorPos
515-
508+ if textToTranslateTypeforms is not None :
509+ # Typeforms must be adapted to represent normalized characters.
510+ textToTranslateTypeforms = [
511+ textToTranslateTypeforms [strOffset ] for strOffset in converter .computedEncodedToStrOffsets
512+ ]
513+ if cursorPos is not None :
514+ # Convert the cursor position to a normalized offset.
515+ cursorPos = converter .strToEncodedOffsets (cursorPos )
516516 self .brailleCells , brailleToRawPos , rawToBraillePos , self .brailleCursorPos = louisHelper .translate (
517517 [handler .table .fileName , "braille-patterns.cti" ],
518518 textToTranslate ,
0 commit comments