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

terminalDiff between 2 terminals or full screen data #4

Closed
jedi4ever opened this issue Apr 16, 2013 · 6 comments
Closed

terminalDiff between 2 terminals or full screen data #4

jedi4ever opened this issue Apr 16, 2013 · 6 comments

Comments

@jedi4ever
Copy link
Contributor

Hi I'm trying the following scenario.

On the server side I have a terminal that receives the write changes. I figured from the node-terminal that I can use the Termdiff to calculate the difference since the last writes.

The downside of the current terminalDiff is that you could only use it once and then the internal oldBuffer gets reset.

The problem I'm facing is that when new clients connect they need a 'full' resync of the terminal state. I could opt to add a Termdiff.fullDiff to create a kind of 'total'screen state patch.

Another approach could be to keep 2 terminals and make Termdiff a function between (term1,term2).

To get the full state you could:

var backendTerm = new Terminal();
backendTerm.write('some stuff');

var freshTerm = new Terminal() ; 
var diff = freshTerm.diff(backendTerm);

be curious what approach you'd suggest.

@jedi4ever
Copy link
Contributor Author

This is how the headless-terminal approaches the same on 'fresh' connect

https://github.com/dtinth/ttycast/blob/master/app.js#L67

@Gottox
Copy link
Owner

Gottox commented Apr 16, 2013

I'll think about a good solution. :)

@Gottox
Copy link
Owner

Gottox commented Apr 17, 2013

For now, just use two Terminals and write to both.

@jedi4ever
Copy link
Contributor Author

using both Terminals is not going to solve it, let me explain:

  • a web client A connects to a shell session , the node server will have both an internal term and a browser term for webclientA
  • if web client B connects to the same shell session, he will only receive updates , not the beginning. I also can't use the internal term or termdiff as this will not be in sync with the (empty) term from webclientB.

I'll spent some more time on it tomorrow.

@jedi4ever
Copy link
Contributor Author

I've started on a diff system in this branch -

https://github.com/jedi4ever/terminal.js/blob/terminal.diff-apply/lib/terminal.js#L396

It would allow you detect the changes between two terms. This could later be used for the Termdiff internally.
Notice that I had to 'break' the diff format as I had to include a way to specify meta changes, not only lines changes.

love to hear your thoughts on this!

@jedi4ever
Copy link
Contributor Author

#14 will solve my diff & apply issue.

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

No branches or pull requests

2 participants