lxd-demo-server icon indicating copy to clipboard operation
lxd-demo-server copied to clipboard

Switch to xterm.js

Open techtonik opened this issue 8 years ago • 9 comments

It is impossible to copy/paste instructions into Try it online console to try things. Context menu doesn't work for this either.

techtonik avatar Aug 24 '16 06:08 techtonik

That's why I made it so you can click on any of the commands in the instruction to have it executed into the terminal session.

The javascript terminal library we're using doesn't do so well with copy/paste and I'm not sure that they'll be making much progress on that.

stgraber avatar Aug 24 '16 13:08 stgraber

linuxcontainers.org website uses term.js: https://github.com/chjj/term.js

This is not maintained anymore, and as mentioned on the github page, the official successor is: https://github.com/sourcelair/xterm.js

In lxd-webgui, i just exchanged term.js with the sourcelair xterm.js. Everything still worked perfectly, and i had paste support with ctrl-shift-v.

https://github.com/dobin/lxd-webgui/commit/14c4b74bbc738192e65cf3064f13ca390365f9fa

dobin avatar Sep 01 '16 17:09 dobin

So I just tried to replace term.js with xterm.js and rendering is completely broken...

stgraber avatar Sep 01 '16 21:09 stgraber

So if either of you want to volunteer to port github.com/lxc/linuxcontainers.org from term.js to xterm.js, I'd certainly appreciate it. Note that validating the setup is always a bit tricky and it took me a couple of weeks to get term.js to render perfectly on all the setups we care about:

  • Chrome on Linux
  • Chrome on Windows
  • Chrome on Android phone
  • Chrome on Android tablet
  • Firefox on Linux
  • Firefox on Windows

Especially making sure the things render properly in both very wide windows (fullscreen) and very narrow ones. Some of the font-sizing logic needed a fair amount of tweaking to convert the available screen estate in pixels to the number of columns for the terminal.

stgraber avatar Sep 01 '16 21:09 stgraber

I'll have a look, as I anyway want to use lxd-demo-server for a private project.

dobin avatar Sep 02 '16 07:09 dobin

I see that https://github.com/sourcelair/xterm.js is pretty active, so there are chances to fix rendering bugs upstream if somebody is going to report that. Are there any tests to check that is renders perfectly?

techtonik avatar Sep 02 '16 21:09 techtonik

Well, I'm not sure that it's an actual upstream bug. It's just that @dobin said that it worked as a drop-in replacement for him, which it didn't for me and suggests there are a bunch of javascript and css changes I'd have to do to get things back to working order.

I don't believe that they pretend to be exactly compatible with term.js, though they mostly are since it's effectively a fork.

stgraber avatar Sep 02 '16 21:09 stgraber

If it is a terminal, then all you need is a websocket for stdin and stdout of controlling terminal, which is the browser. Right?

techtonik avatar Sep 02 '16 21:09 techtonik

Here is the alternative officially tested and maintained by Chromium team https://chromium.googlesource.com/apps/libapps/+/master/hterm/doc/ChangeLog.md and how to embed https://chromium.googlesource.com/apps/libapps/+/master/hterm/doc/embed.md

techtonik avatar Sep 06 '16 00:09 techtonik