@@ -455,6 +455,8 @@ def getText(self, i, stop=None, dataType=False):
455455 block = ""
456456 start = i
457457 text = False
458+ normal_block_expect_02 = False
459+
458460 while True :
459461 if stop and stop == i :
460462 break
@@ -471,6 +473,10 @@ def getText(self, i, stop=None, dataType=False):
471473 length = self .getLength (i )
472474 block += "[{}" .format (FormatHex (c ))
473475
476+ # Mark if we expect an [02] before the end of the block
477+ if c == 0x19 :
478+ normal_block_expect_02 = True
479+
474480 # Get the rest of the control code.
475481 codeEnd = i + length
476482 while i < codeEnd :
@@ -479,7 +485,10 @@ def getText(self, i, stop=None, dataType=False):
479485 block += "]"
480486
481487 # Stop if this is a block-ending character.
482- if c == 0x02 or c == 0x0A :
488+ if c == 0x02 and normal_block_expect_02 :
489+ # But don't stop if we expect an [02] that doesn't end the block
490+ normal_block_expect_02 = False
491+ elif c == 0x02 or c == 0x0A :
483492 break
484493 # Check if it's a special character.
485494 elif c == 0x52 or c == 0x8b or c == 0x8c or c == 0x8d :
@@ -737,4 +746,4 @@ def main():
737746 print ("\r Program execution aborted." )
738747
739748if __name__ == "__main__" :
740- main ()
749+ main ()
0 commit comments