Skip to content

Use terminal emulator for parsing scrollback #24

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

Closed
wants to merge 7 commits into from

Conversation

code-asher
Copy link
Member

@code-asher code-asher commented Aug 24, 2022

Example problem: an application may ask the client for capabilities or
cursor positions. Replaying that will make the client re-send that information
on reconnect.

This causes undefined behavior. It might get inserted into the terminal
as regular text or it might get ignored if the application is still running
and decides to do so (seems to depend on how much scrollback we have).

My current idea is to try copying what VS Code does which is have a full terminal
emulator running on the server, feed it the input, then serialize the current state
and replay that instead. It is working but I only have text and need to serialize
colors. Also probably need to serialize things like cursor positions and the window
title.

This might still result in issues since we are not running the exact same xterm
code but hopefully it is good enough. I am using a fork of darktile (not pushed
up yet).

Edit: since this is becoming quite involved and still runs the risk of desync
we are going to use screen instead.

Going to add an alternate screen test next.
@code-asher code-asher force-pushed the code-asher/sc-23737 branch 2 times, most recently from 0602559 to a3381f1 Compare August 24, 2022 01:37
@code-asher code-asher force-pushed the code-asher/sc-23737 branch 3 times, most recently from 19a1bc2 to aefc86c Compare August 24, 2022 02:53
This makes it easier to test reconnects manually.
@code-asher code-asher force-pushed the code-asher/sc-23737 branch from aefc86c to 065e19a Compare August 25, 2022 23:53
@code-asher code-asher changed the title Exclude alternate screen buffer from scrollback Use terminal emulator for parsing scrollback Aug 25, 2022
When chaining there would be multiple buffers so it probably makes the
most sense to only have a single buffer alongside the local process.

Also when using a terminal emulator this will make it easier to handle
the resizing.
This way you do not need a subsequent resize and we can have the right
size from the get-go.

Plus the terminal emulator that will be added does not like when the
initial size is zero (will get division by zero panics).
@code-asher code-asher force-pushed the code-asher/sc-23737 branch from 065e19a to fc9a782 Compare August 26, 2022 00:36
@code-asher code-asher closed this Sep 12, 2022
@code-asher code-asher deleted the code-asher/sc-23737 branch September 12, 2022 21:10
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

Successfully merging this pull request may close these issues.

1 participant