Skip to content

Update to work with xtermjs 4 #19

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

Merged
merged 4 commits into from
Jun 26, 2020
Merged

Conversation

coolreader18
Copy link
Contributor

This should still be compatible with xterm v3, though I haven't actually tested it. The onData and onResize methods have been there for a while (typescript typings for xtermjs 3.14), and in theory even the new addon system could be used in xtermjs 3.14, though the old way of passing a terminal to the constructor still works.

@coolreader18 coolreader18 requested a review from wavesoft January 27, 2020 21:42
@coolreader18
Copy link
Contributor Author

@wavesoft would you be able to take a look at this?

@wavesoft
Copy link
Owner

Hello and thanks for the PR @coolreader18 ! Will have a look now

Copy link
Owner

@wavesoft wavesoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @coolreader18 !
I tried this with the v3 API and it's not working, so I proposed a few changes. Plus, what do you think about maintaining the old LocalEchoController constructor interface?

@@ -36,12 +36,19 @@ export default class LocalEchoController {
this._cursor = 0;
this._activePrompt = null;
this._activeCharPrompt = null;
this._termSize = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a good practice towards V8 optimisation it's a good idea to describe the object shape in the constructor and avoid mutating it later. So I would vote for keeping some defaults here, like so:

    this._termSize = {
      cols: 0,
      rows: 0
    }

const localEcho = new LocalEchoController(term);
// Create a local echo controller (xterm.js >=v4)
const localEcho = new LocalEchoController();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think instead of breaking the API (in order to maintain some seamless migration from v3 to v4) to move this detection in the constructor?

For instance:

if (!term.onData) {
   // We are dealing with v4 API
} else {
   // We are dealing with v3 API
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd think that people using this library would be the ones specifying the version of xterm that they're using, and even if they aren't, passing the terminal to the constructor should still work even in v4.

@arthur5005
Copy link

It looks as if the reviewer suggestions have been applied in the latest commit. Can we expect this PR to be merged soon?

@coolreader18 coolreader18 requested a review from wavesoft April 1, 2020 03:05
@ppacory
Copy link

ppacory commented Apr 22, 2020

is it ready for xtermjs 4.x ? can't find a release working with xtermjs 4.x

fikrikarim added a commit to fikrikarim/local-echo that referenced this pull request May 11, 2020
@pre
Copy link

pre commented Jun 10, 2020

How about ditching support for older xtermjs versions altogether? An older version of local-echo can be used with an oder xtermjs, but there is currently no version of local-echo that works with the current version of xtermjs.

@RangerMauve
Copy link
Contributor

I just installed the branch from github and it's working great.

@pre
Copy link

pre commented Jun 10, 2020

I concur - master does not work but the branch of this PR does work.

I suggest a merge.

@jasonolmstead33
Copy link

@wavesoft @coolreader18 any update on this? looking to get a local-echo working with xterm >= v4

@RangerMauve
Copy link
Contributor

@jasonolmstead33 I suggest installing from the branch instead of the main repo. 😁

@jasonolmstead33
Copy link

@RangerMauve thats what ive done for now, thanks, hoping we can get it as part of master :)

@wavesoft
Copy link
Owner

Hey guys! Sorry for the long absence, going to land this, run some checks and cut a new release 👍

@wavesoft wavesoft merged commit 8d0b7f5 into wavesoft:master Jun 26, 2020
@RReverser
Copy link

@wavesoft It looks like release hasn't been cut yet?

@RReverser
Copy link

@wavesoft Ping. Can you please at least add a prebuilt version to the repo? For now I can do npm install github:wavesoft/local-echo, but then need to cd node_modules && npm install && npm run build, which is quite tedious and error-prone.

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.

8 participants