Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for DEC special graphics #182

Open
Moult opened this issue Dec 9, 2024 · 1 comment
Open

Support for DEC special graphics #182

Moult opened this issue Dec 9, 2024 · 1 comment

Comments

@Moult
Copy link
Contributor

Moult commented Dec 9, 2024

This is used in the majority of Nethack ttyrecs. There's a thing called https://en.wikipedia.org/wiki/DEC_Special_Graphics where if \e(0 is sent, it toggles some codes.

Steps to reproduce:

import pyte
screen = pyte.Screen(30, 1)
stream = pyte.Stream(screen)
data = b'x\x1b(0x\x1b(Bx'
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'))

Expected: x|x
Actual: xxx

Sample code produces:

0 x default default False 
1 x default default False 
2 x default default False 
x│x
@Moult
Copy link
Contributor Author

Moult commented Dec 23, 2024

As a workaround, I can set stream.use_utf = False.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant