-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add marshalling methods for recreating terminal state #1
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR! My only real hesitation is that I'm not too confident I'll be able to keep this working through the many refactors this repo has gone through, since I'm not 100% familiar with the use case and don't have anything that would exercise it myself. Do you think you'd be able to add some sort of test? Maybe even a really high level one that checks for the property you want: given a Thanks again! |
Took a bit of effort but I've managed to get a test going that runs through all of the existing data and compares at each frame that a cloned terminal is deeply equal to the original terminal. It works for most of the data except for the "writing-readme" set. |
Let me know if any of the approaches I took don't seem like the right direction. I added a small custom RGB implementation for |
I've moved the |
Thanks for keeping this alive - sorry I haven't had time to review yet, haven't forgotten! (The tab remains open...) |
The current render methods change the output in a way that's maybe easier to render to an image. However, this behavior makes it difficult to dump the contents of a midterm emulated terminal to a TUI and have the state accurately represented. For example, cursor state is currently rendered directly as the cell's format.
This PR provides a
MarshalBinary
method that attempts to produce an output such that, if it is read back into a fresh midterm instance, the state should be identical. A use case for this is to have midterm receive input with a TUI connecting later and being able to reproduce output as if it had received the original input stream. This is probably a far from perfect implementation but it works for me for an "alternate screen" type program.