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

image support #2503

Closed
wants to merge 162 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
b2352ea
working sixel draft
jerch Oct 24, 2019
11b1458
fix linter and @types/node dep
jerch Oct 24, 2019
4f31ba9
install addon deps in CI
jerch Oct 24, 2019
435e2c4
fix linter error from addon dep
jerch Oct 24, 2019
aa11cfa
Merge branch 'master' into addon-images
jerch Oct 24, 2019
81946b1
Merge branch 'master' into addon-images
jerch Oct 25, 2019
502562e
Merge branch 'addon_build' into addon-images
jerch Oct 25, 2019
02c55d8
revert CI pipeline changes
jerch Oct 25, 2019
912ccb3
restrict linter to addons/*/src files
jerch Oct 25, 2019
9540037
Merge branch 'addon_build' into addon-images
jerch Oct 25, 2019
2a6d4f0
Merge branch 'addon_build' into addon-images
jerch Oct 26, 2019
c65f676
Merge branch 'master' into addon-images
jerch Oct 26, 2019
3c5c8be
Merge branch 'master' into addon-images
jerch Oct 29, 2019
e147673
3x speedup with low level SIXEL handler
jerch Oct 29, 2019
e128e40
Merge branch 'addon-images' of github.com:jerch/xterm.js into addon-i…
jerch Sep 22, 2020
b17dc31
Merge branch 'master' into addon-images
jerch Sep 22, 2020
b1193aa
fix incompatible type declaration
jerch Sep 22, 2020
091c421
make linter happy
jerch Sep 22, 2020
715143c
use ImageBitmap internally, remove different renderer hacks
jerch Sep 27, 2020
ab63ddd
Merge remote-tracking branch 'upstream/master' into addon-images
jerch Sep 27, 2020
750a077
Merge branch 'master' into addon-images
jerch Oct 24, 2020
dfc1ddc
Merge branch 'master' into addon-images
jerch Oct 24, 2020
988c384
remove marker overload
jerch Oct 24, 2020
4a6ba2b
Merge branch 'master' into addon-images
jerch Oct 31, 2020
9c79dff
own imagerenderer layer to work with all render types
jerch Nov 1, 2020
f981f13
- sixel handler init with params
jerch Nov 8, 2020
9f90781
Merge branch 'master' into addon-images
jerch Nov 8, 2020
a67b81b
fix tsconfig issues
jerch Nov 8, 2020
eb52952
refactor to a more modular approach
jerch Nov 8, 2020
9e3f284
multiple changes:
jerch Nov 10, 2020
8954f17
changes:
jerch Nov 11, 2020
fa29fc9
update readme and exported types
jerch Nov 11, 2020
d7a4991
changes:
jerch Nov 11, 2020
3bf8e62
Merge branch 'master' into addon-images
jerch Nov 11, 2020
80e77ef
fix eslint OOM by merging tsconfig lookups
jerch Nov 11, 2020
ba2d27c
skip failing test for now
jerch Nov 11, 2020
9a67407
fix leftover artefacts on image layer
jerch Nov 12, 2020
a32a2d1
add DA1 overload and xterm GA sequence, fix SIXEL bg handling
jerch Nov 12, 2020
1a2066e
implement a max size storage limit with hard eviction rule
jerch Nov 12, 2020
00e8ade
add placeholder option for deleted images
jerch Nov 13, 2020
df48f27
couple of eviction rules:
jerch Nov 14, 2020
896dfd1
expose some settings on demo page
jerch Nov 15, 2020
2399310
add sixel example file
jerch Nov 15, 2020
07a2d24
multiple WIP changes:
jerch Nov 16, 2020
b57646f
quickhack to export image as blob on ctrl+click
jerch Jan 19, 2021
18855d1
Merge branch 'master' into addon-images
jerch Jan 31, 2021
43f84c1
fix changed handler hook
jerch Jan 31, 2021
8a8fcbd
fix linter
jerch Jan 31, 2021
d8fef13
Merge branch 'master' into addon-images
jerch Feb 7, 2021
dbba13b
Merge branch 'master' into addon-images
jerch Mar 19, 2021
6d8bd8a
remove iTerm2 support and own protocol draft
jerch Mar 19, 2021
1ff4799
add example pictures as fixtures
jerch Mar 19, 2021
daf3a58
make linter happy
jerch Mar 19, 2021
82cbbd1
worker based sixel decoding
jerch Mar 21, 2021
eeeb8f6
Merge branch 'master' into addon-images
jerch Mar 21, 2021
411078c
use proper type inference on messages
jerch Mar 21, 2021
4180f6e
better worker integration:
jerch Mar 21, 2021
9514225
basic private accessor test
jerch Mar 21, 2021
ced99a5
update addon requirements, fix bundling
jerch Mar 21, 2021
346e232
remove click hack, doc next steps
jerch Mar 21, 2021
8522b90
fix type exports and README
jerch Mar 21, 2021
db9bfc5
layout few more next steps
jerch Mar 23, 2021
46473ff
remove some of the private hacks
jerch Mar 23, 2021
a0b5fa9
fix tsconfig paths in test project
jerch Mar 24, 2021
c09128a
kiss - remove storage remnants from iterm image protocols
jerch Mar 25, 2021
c9337f8
better typing, optimized ExtendedAttrsImage creation
jerch Mar 25, 2021
0fd64ee
expose cell metrics internally
jerch Mar 25, 2021
7e0e54c
explicit test for buffer and attribute private access
jerch Mar 25, 2021
6993f4d
Merge branch 'master' into addon-images
jerch Mar 26, 2021
4b14446
add comment about garbage on screen
jerch Mar 26, 2021
143f113
Merge branch 'master' into addon-images
jerch May 10, 2021
5a6f3a7
make linter happy
jerch May 10, 2021
e054ec7
change integration test port to 3001
jerch May 10, 2021
0b3aa46
Merge branch 'master' into addon-images
jerch May 16, 2021
7166bf6
fix Promise<void>
jerch May 16, 2021
736fc31
fix mocha timeout error
jerch May 16, 2021
7de2430
Merge branch 'master' into addon-images
jerch May 20, 2021
58e3c6e
fix safari render bug
jerch May 24, 2021
c2c753e
add banding test
jerch May 24, 2021
e0f23d2
custom setting to fit oversized images to viewport width
jerch May 25, 2021
005648c
apply eviction after rescaling to avoid wrong image accounting
jerch May 29, 2021
c98eb8f
growing rectangle test without flickering
jerch May 29, 2021
b98c126
skip undefined image eAttr in render
jerch May 29, 2021
61c5615
fix DOM renderer rescaling issue
jerch May 29, 2021
e0d7b3e
onResize hook for right expansion
jerch May 29, 2021
c145c63
make linter happy
jerch May 29, 2021
8887564
Merge branch 'master' into addon-images
jerch May 30, 2021
0d9a543
fix marker memory leak
jerch Jun 4, 2021
dfa8b84
remove <TypeX>yz casts
jerch Jun 4, 2021
69e9779
cleanup fitOversizedToViewportWidth
jerch Jun 4, 2021
4c0a5d4
use transferable pixel buffer
jerch Jun 4, 2021
124c603
fix type casts
jerch Jun 4, 2021
019986e
Merge branch 'master' into addon-images
jerch Jun 4, 2021
1e2f24e
Merge branch 'master' into addon-images
jerch Jun 10, 2021
f2a8556
Merge branch 'master' into addon-images
jerch Jun 12, 2021
f755ac4
activate windowOptions on addon load, polish docs
jerch Jun 13, 2021
c9fe4f1
Merge branch 'addon-images' of github.com:jerch/xterm.js into addon-i…
jerch Jun 13, 2021
ebc7145
basic image data retrieval API
jerch Jun 13, 2021
18c898b
limit pixels for single image
jerch Jun 13, 2021
84071e3
cleanup FIXMEs
jerch Jun 13, 2021
90864c5
fix integration tests
jerch Jun 13, 2021
28e14b6
multiple mostly cleanup changes:
jerch Jun 14, 2021
708517e
revert false simplification
jerch Jun 14, 2021
b8f6c26
minor fixes
jerch Jun 14, 2021
10ba35f
change eslint project settings
jerch Jun 14, 2021
3eedf92
Merge branch 'master' into addon-images
jerch Jul 8, 2021
4a89f15
Merge branch 'master' into addon-images
jerch Aug 18, 2021
dfc7e23
fix private coreService access
jerch Aug 19, 2021
8c09894
Merge branch 'master' into addon-images
jerch Aug 19, 2021
32adff2
remove leftover .only in test suite
jerch Aug 19, 2021
ded80b3
Merge branch 'master' into addon-images
jerch Aug 21, 2021
652e03a
Merge branch 'master' into addon-images
jerch Aug 28, 2021
db8eb2b
update to new sixel decoder
jerch Aug 31, 2021
73459d6
Merge branch 'addon-images' of github.com:jerch/xterm.js into addon-i…
jerch Aug 31, 2021
27218f6
Merge branch 'master' into addon-images
jerch Aug 31, 2021
16eb95a
fix yarn.lock to point to right version
jerch Sep 2, 2021
5a0939d
Merge branch 'master' into addon-images
jerch Sep 2, 2021
a4587f9
Merge branch 'master' into addon-images
jerch Sep 5, 2021
6676dec
cleanup fixtures
jerch Sep 8, 2021
ce499d1
remove dispose from readme example
jerch Sep 8, 2021
85d8d73
add demo buttons
jerch Sep 8, 2021
7ed3c48
fix xterm dep version
jerch Sep 8, 2021
3ae28d2
simplify worker message types
jerch Sep 8, 2021
cd1448b
add example image to readme
jerch Sep 8, 2021
0277697
use star comments in typings
jerch Sep 8, 2021
07bc129
use import type, fix pixel limit, remove cmdline bookmarks
jerch Sep 8, 2021
3b720fe
Merge branch 'addon-images' of github.com:jerch/xterm.js into addon-i…
jerch Sep 8, 2021
c9f27a8
make linter happy
jerch Sep 8, 2021
f128c04
Merge branch 'master' into addon-images
jerch Sep 28, 2021
87365f1
flip DECSET 80 & 7730 settings
jerch Sep 28, 2021
14b4d4c
fix cursor positioning tests
jerch Sep 28, 2021
09ffed4
fix cursor positioning tests
jerch Sep 28, 2021
276d291
reduce perma held memory for sixel decoding to 4MB
jerch Sep 28, 2021
99e4072
report true window area for sixel geo read if within pixelLimit
jerch Sep 28, 2021
7f003fe
use famous snake sixel example image from libsixel repo
jerch Sep 28, 2021
aaef0fd
widen type to HTMLElement
jerch Sep 28, 2021
bfa0de7
update xterm peer dep version
jerch Sep 28, 2021
e073d8b
make workerPath mandatory
jerch Sep 28, 2021
918113f
fix page eval in api test
jerch Sep 28, 2021
5c64048
remove TODO list from source code
jerch Sep 28, 2021
488cddc
change pixelLimit description
jerch Sep 28, 2021
b9969e9
simplify partial addon options
jerch Sep 28, 2021
f712933
simplify private interface imports from repo base
jerch Sep 28, 2021
ba07f6f
use arrow functions in API tests
jerch Sep 28, 2021
9199b53
use helper for test startup
jerch Sep 28, 2021
ad914a8
shorten private accessor tests
jerch Sep 28, 2021
85c0df0
rename Dim to Dimensions
jerch Sep 28, 2021
8eaeb1e
use const enum for worker message type
jerch Sep 28, 2021
9c2caf0
rename clearCheckerInterval, use shorthand notation for promise return
jerch Sep 28, 2021
c1cb794
fix _poolCheckerInterval name access in test
jerch Sep 28, 2021
dd8050a
fix _poolCheckerInterval name access in test
jerch Sep 28, 2021
336ef5e
Merge branch 'master' into addon-images
jerch Oct 12, 2021
d882cef
fix reported canvas size, rounding fix in XTSMGRAPHICS
jerch Oct 12, 2021
47412ec
Merge branch 'master' into addon-images
jerch Oct 20, 2021
6da04ff
Merge branch 'master' into addon-images
jerch Oct 22, 2021
ba50ec6
Merge branch 'master' into addon-images
jerch Oct 25, 2021
7b1fcad
Merge branch 'master' into addon-images
jerch Nov 2, 2021
bc1f1d4
fix unknown type in catch
jerch Nov 2, 2021
74d12d1
Merge branch 'master' into addon-images
jerch Nov 6, 2021
9468d0d
fix shared palette handling
jerch Nov 7, 2021
55db19c
use enum for ack payload
jerch Nov 7, 2021
414172c
Merge branch 'master' into addon-images
jerch Nov 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions addons/xterm-addon-image/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib
node_modules
5 changes: 5 additions & 0 deletions addons/xterm-addon-image/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/*.api.js
**/*.api.ts
tsconfig.json
.yarnrc
webpack.config.js
19 changes: 19 additions & 0 deletions addons/xterm-addon-image/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2019, The xterm.js authors (https://github.com/xtermjs/xterm.js)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
3 changes: 3 additions & 0 deletions addons/xterm-addon-image/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## xterm-addon-image

TODO...
24 changes: 24 additions & 0 deletions addons/xterm-addon-image/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
jerch marked this conversation as resolved.
Show resolved Hide resolved
"name": "xterm-addon-image",
"version": "0.0.1",
"author": {
"name": "The xterm.js authors",
"url": "https://xtermjs.org/"
},
"main": "lib/xterm-addon-image.js",
"types": "typings/xterm-addon-image.d.ts",
"repository": "https://github.com/xtermjs/xterm.js",
"license": "MIT",
"scripts": {
"build": "../../node_modules/.bin/tsc -p src",
"prepackage": "npm run build",
"package": "../../node_modules/.bin/webpack",
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^4.0.0"
},
"dependencies": {
"sixel": "^0.12.0"
}
}
67 changes: 67 additions & 0 deletions addons/xterm-addon-image/src/ImageAddon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*
* Implements image support for the terminal.
*/

import { Terminal, IDisposable, ITerminalAddon } from 'xterm';
import { SixelDecoder, DEFAULT_BACKGROUND, PALETTE_ANSI_256, PALETTE_VT340_COLOR, PALETTE_VT340_GREY, RGBA8888 } from 'sixel';
import { ImageStorage } from './ImageStorage';

interface IImageAddonOptions {
sixelSupport?: boolean;
sixelScroll?: boolean;
sixelPaletteLimit?: number;
sixelPrivatePalette?: boolean;
sixelDefaultPalette: 'VT340-COLOR' | 'VT340-GREY' | 'ANSI256';
}

const DEFAULT_OPTIONS: IImageAddonOptions = {
sixelSupport: true,
sixelScroll: true,
sixelPaletteLimit: 256,
sixelPrivatePalette: true,
sixelDefaultPalette: 'ANSI256'
};

export class ImageAddon implements ITerminalAddon {
jerch marked this conversation as resolved.
Show resolved Hide resolved
private _opts: IImageAddonOptions;
private _storage: ImageStorage | undefined;
private _sixelHandler: IDisposable | undefined;
private _sixelPalette: RGBA8888[];
constructor(opts: IImageAddonOptions = DEFAULT_OPTIONS) {
this._opts = Object.assign({}, DEFAULT_OPTIONS, opts);
this._sixelPalette = this._opts.sixelDefaultPalette === 'VT340-COLOR' ? PALETTE_VT340_COLOR
: this._opts.sixelDefaultPalette === 'VT340-GREY' ? PALETTE_VT340_GREY
: PALETTE_ANSI_256;
}
public activate(terminal: Terminal): void {
this._storage = new ImageStorage(terminal);
if (this._opts.sixelSupport && !this._sixelHandler) {
this._sixelHandler = terminal.parser.addDcsHandler({final: 'q'}, (data, params) => {
const pal = this._opts.sixelPrivatePalette ? Object.assign([], this._sixelPalette) : this._sixelPalette;
// TODO: 0 - get startup background, 2 - get BCE
const dec = new SixelDecoder(params[1] === 1 ? 0 : DEFAULT_BACKGROUND, pal, this._opts.sixelPaletteLimit);
dec.decodeString(data);
if (this._storage) {
this._storage.addImageFromSixel(dec);
}
return true;
});
}

terminal.onRender(this._storage.render.bind(this._storage));
}

public dispose(): void {
if (this._sixelHandler) {
this._sixelHandler.dispose();
this._sixelHandler = undefined;
}
if (this._storage) {
this._storage.dispose();
this._storage = undefined;
}
}
}
Loading