Skip to content

Commit

Permalink
Add image (imgcat) support in the terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzhang committed Sep 11, 2023
1 parent 0792c6b commit 403d9da
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"sshx-xterm": "5.2.1",
"svelte": "^3.59.2",
"svelte-feather-icons": "^4.0.1",
"xterm-addon-image": "^0.5.0",
"xterm-addon-web-links": "^0.8.0",
"xterm-addon-webgl": "^0.15.0"
},
Expand Down
11 changes: 8 additions & 3 deletions src/lib/ui/XTerm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,13 @@
$: term?.resize(cols, rows);
onMount(async () => {
const { Terminal } = await import("sshx-xterm");
const { WebLinksAddon } = await import("xterm-addon-web-links");
const { WebglAddon } = await import("xterm-addon-webgl");
const [{ Terminal }, { WebLinksAddon }, { WebglAddon }, { ImageAddon }] =
await Promise.all([
import("sshx-xterm"),
import("xterm-addon-web-links"),
import("xterm-addon-webgl"),
import("xterm-addon-image"),
]);
await waitForFonts();
Expand Down Expand Up @@ -148,6 +152,7 @@
term.loadAddon(new WebLinksAddon());
term.loadAddon(new WebglAddon());
term.loadAddon(new ImageAddon({ enableSizeReports: false }));
term.open(termEl);
Expand Down

0 comments on commit 403d9da

Please sign in to comment.