573 utf8Len = 4 |
573 utf8Len = 4 |
574 elif (utf8Ch[0] & 0xE0) == 0xE0: |
574 elif (utf8Ch[0] & 0xE0) == 0xE0: |
575 utf8Len = 3 |
575 utf8Len = 3 |
576 elif (utf8Ch[0] & 0xC0) == 0xC0: |
576 elif (utf8Ch[0] & 0xC0) == 0xC0: |
577 utf8Len = 2 |
577 utf8Len = 2 |
578 column -= 1 # will be incremented |
578 column -= 1 |
579 # again later |
579 # will be incremented again later |
580 elif len(utf8Ch) == utf8Len: |
580 elif len(utf8Ch) == utf8Len: |
581 ch = utf8Ch.decode('utf8') |
581 ch = utf8Ch.decode('utf8') |
582 self.pr.add(ch, style) |
582 self.pr.add(ch, style) |
583 utf8Ch = b"" |
583 utf8Ch = b"" |
584 utf8Len = 0 |
584 utf8Len = 0 |
585 else: |
585 else: |
586 column -= 1 # will be incremented |
586 column -= 1 |
587 # again later |
587 # will be incremented again later |
588 else: |
588 else: |
589 self.pr.add(ch.decode(), style) |
589 self.pr.add(ch.decode(), style) |
590 column += 1 |
590 column += 1 |
591 |
591 |
592 pos += 1 |
592 pos += 1 |