pyte icon indicating copy to clipboard operation
pyte copied to clipboard

Repeated character escape sequence not handled

Open Moult opened this issue 1 year ago • 0 comments

Given this fed into a stream:

a\x1b[4b

This means that the a character should be releated 4 times. However this does not seem to be handled by pyte. See the documentation on this website:

CSI Ps b  Repeat the preceding graphic character Ps times (REP).

Expected behaviour: aaaaa Actual behaviour: a

Sample code to reproduce:

import pyte
screen = pyte.Screen(30, 1)
stream = pyte.Stream(screen)
data = b'a\x1b[4b'
stream.feed(data.decode('cp437'))
for y, row in screen.buffer.items():
    for x, cell in row.items():
        print(x, cell.data, cell.fg, cell.bg, cell.bold, "reversed" if cell.reverse else "")

import sys
sys.stdout.write(data.decode('cp437')) # will give aaaaa

This will output:

0 a default default False 
aaaaa

Moult avatar Dec 11 '24 04:12 Moult