-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
image support #2503
image support #2503
Conversation
@Tyriar Not sure how to deal with outer dependencies in addons - I kept the dep in the addon local package.json. Imho it belongs there, but our build scripts do not respect this yet. For CI I fixed it temporarily by adding another script to the pipelines, locally a |
To repeat myself: One you have image support, it is conceptually easy to generalize (at least at the user level) to embedded HTML as an opaque blob, at least at the full-width Of course there are security implications (beyond those of images), so it probably should be an optional addon, with an HTML sanitizer (feel free to base one on DomTerm's). |
@PerBothner Well the div-overlay idea would work, but breaks with lots of grid mechanics. We most likely will have such an extension one day (as already indicated for "marker overlays"), but I am not sure if images should use that. The idea for images is still to get it working for any terminal, not only HTML based ones that can easily layer stuff on top. |
Just wanted to pass along: the freedesktop thread is basically done with everyone exhausted and throwing up their hands. But sixel around the world is doing pretty good right now.
|
@klamonte Thx for the update 👍 Yeah its somewhat a shame we came to no usable conclusion in the thread. I am not blaming anyone in particular, I for myself was not able to come up with a good solution, so yeah its also partly my own fault. Ofc I am not done with the topic, still it got somewhat out of my focus. We have a few things to get straight in the corelibs before we can integrate the prototype here further.
Glad you like its speediness 😉. JS isnt that bad after all, but gets very C-ish for max perf. |
I rebult this version on an older laptop running Fedora 33. However, I realize that may not help - it's not old enough ... Even my ancient Fedora 30 laptop was updated recently enough to be running libc 2.29 ... Maybe it's time you updated your OS? |
@PerBothner Yep, that version works for me and gives (with Chrome):
Edit: |
@hackerb9 Sweet that worked, giving me:
Btw with full roundtrip measuring for every single frame xtermjs will fall short alot, because we have a much longer "line" than most native TEs, that more or less sit directly on the PTY. Thinking about it, it is somewhat crazy: Edit: Updated numbers with nvidia card. |
Thanks for trying out DomTerm. I tried running sixvid. Nyatocat got upto about 200 fps. spring.mp4 didn't print a number (even after It does look like increasing buffer size (at least the buffer in the server for reading pty output) might be a good idea. However, I do get occasional exceptions: |
With the new or the old lib version? (Btw I am running these tests with intel graphics, can give it another go with the nvidia card as well, might help with webgl variant 😸) |
I get exceptions with the new version. This is the logic - maybe you can see something wrong:
|
@PerBothner Yepp the intermediate new ImageData(new Uint8ClampedArray(buffer, 0, width * height * 4), width, height) (Reason: The lib returns a borrowed Uint32Array, which might have a bigger buffer underneath from a previous run, then it will not fit into the |
@jerch Your proposed seems to fix the problem. "Btw that -B switch is pure magic, no clue how you do that, very impressive." The There is of course more to it ( If you're interested in hooking up xterm.js with the domterm server, that is quite reasonable. In fact there is code in the domterm sources to support just that; however I haven't been maintaining it. It should even be possible for the same server to manage at the same time both DomTerm sessions (for rich text, html, images etc) and xterm.js sessions (for higher speed and perhaps some other features), though I haven't tried that. |
@PerBothner Ah ic, so DomTerm basically provides its own terminal server infrastructure, that holds the pty connections and uses installed browsers as frontend directly spawned from there. That a very sensible approach and gives you control over things xtermjs kinda lacks as pure frontend component. We get tons of issues regarding proper page embedding, and many integrations get the server part wrong missing properly delegated flow control, encoding handling or securing the websocket transmission (including our demo, but thats only meant to be used for development of xtermjs itself, ppl should not simply c&p that to their production envs). |
Mea culpa! I just noticed that the If you would, please try again with the current version of sixvid. It should not trigger the OOM parachute. I'm curious what the FPS results will be now that they will be accurate. |
@hackerb9 Eww, now we talking about "a long line" kicking in - gives me 51 fps on |
Converting back to draft to resolve these issues before going live:
|
Closing this PR and #3488, as it is unlikely to be added in near future. State: Beside the low level sixel issues above (see last comment) it is a working condition. It can easily be extended by other image protocols using the same internal image storage handling once there is a good candidate. Also see #3488 for remaining issues for a neater overall integration with xterm.js. In theory this PR can be used from another repo to build the addon independently. But be aware, that it heavily relies on internal data structures (mainly for perf and non-duplication reasons), thus might create quite a high maintenance overhead to keep it on par with new xterm.js versions, which somewhat qualifies it to keep in main repo. At least it can be used as a source of ideas for similar approaches/extensions of xtermjs. |
Oh, that's too bad. I was looking forward to using sixel graphics in xtermjs. Will this affect that fork (I forget the name, but it used a terminal server so one could connect from any web browser) that used this sixel implementation? |
@hackerb9 Gimme a few days and I will see if an external repo is a viable workaround (depends on how much can be automatized on new releases of the main repo, and whether needed shims grow too big). Edit: If you mean "DomTerm" with "I forget the name, but it used a terminal server so one could connect from any web browser" - that will not be affected by this, it uses the underlying sixel lib, which is independent, but not this PR code for its final terminal integration. |
Yeah, DomTerm was what I was thinking of. Is there a github page for the sixel lib it uses? |
@hackerb9 Yes you can find the sixel lib here https://github.com/jerch/node-sixel (disclaimer - I am the author, and it is still WIP. The decoder has some test coverage, and I'd consider the tested features as beta quality. It still lacks true paletted mode as in terminal vs. printer mode, which I am unsure to add at all. The encoder is mostly untested and very slow, more in early alpha state.) |
The DomTerm master (as of November 3) uses the new node-sixel 0.15 implementation. The minimized source is in (The DomTerm-2.9.4 release uses the old sixel implementation. I hope to make a DomTerm-2.9.5 after some more testing and polishing.) |
@hackerb9 Here the experimental addon repo: https://github.com/jerch/xterm-addon-image. |
Made a new apporach towards image support in xterm.js, mainly based on the previous addon. Currently only a playground, will see where we can get with this. Also not high on the priority list, the discussion in the terminal-wg is still ongoing.
What works so far:
Planned:
Since the addon has an outer dependency, do aFixed due to changes in build scripts.cd addons/xterm-addon-image && yarn
before callingyarn
in the repo folder. The addon is active in the demo and can be tested by feeding it some sixels.Some preview:
Update:
Since the discussion in terminal-wg is stalled, we should not wait for someone to come up with a "one-fits-all" image solution for terminals. Instead I think we should try to get most SIXEL primitives working, and maybe later on parts of the iTerm2 image protocol.