Compare commits

..
756 Commits
Author SHA1 Message Date
Daniel Imms 9a512d1abd Merge pull request #4975 from Tyriar/tyriar/v5_4_x
Fix publishing of stable
2024-03-01 09:00:46 -08:00
Daniel Imms 6ca8dc54ad Fix publishing of stable 2024-03-01 09:00:33 -08:00
Daniel Imms cff944fe8a Merge pull request #4974 from Tyriar/tyriar/v5_4
v5.4.0
2024-03-01 08:42:37 -08:00
Daniel Imms 72dea6279e v5.4.0 2024-03-01 08:39:19 -08:00
Daniel Imms 37ecb9a6b5 Merge pull request #4965 from jerch/fix_4964
allow uppercase in weblinks
2024-03-01 07:45:20 -08:00
Daniel Imms fb867a914a Merge pull request #4973 from Tyriar/spacing
Fix spacing issue when measuring before element is attached
2024-02-29 07:43:03 -08:00
Daniel Imms 8ef3c10844 Fix spacing issue when measuring before element is attached
See microsoft/vscode#204690
2024-02-29 07:37:32 -08:00
Jörg Breitbart 10fe249877 allow user+password to still match 2024-02-22 09:55:42 +01:00
Jörg Breitbart 5143f904ee remove leftover .only 2024-02-22 09:40:38 +01:00
Jörg Breitbart 768452a519 make linter happy 2024-02-22 09:38:36 +01:00
Jörg Breitbart 547bda6e4f fix #4964 2024-02-22 09:33:21 +01:00
Daniel Imms 6a281bd90e Merge pull request #4953 from arencoskun/master
Expose API method for writing to application side (#4948)
2024-02-02 12:16:03 -08:00
Daniel Imms 1c4e0111cb Merge branch 'master' into master 2024-02-02 12:07:10 -08:00
Daniel Imms 8d1771ef64 Tweak docs 2024-02-02 12:03:08 -08:00
Daniel Imms fb54bb0b6c Merge pull request #4954 from Tyriar/npe
Prevent npe in render service
2024-02-02 10:07:02 -08:00
Daniel Imms 546bcb5133 Prevent npe in render service
See microsoft/vscode#204104
2024-02-02 09:58:21 -08:00
arencoskun b1a72b2e83 Linter fix 2024-02-02 09:04:53 +03:00
arencoskun dce6e31c89 Add headless definitons 2024-02-02 08:59:57 +03:00
arencoskun cddc888065 Add definition to xterm-headless.d.ts 2024-02-01 16:49:15 +03:00
arencoskun 06aa2c86df Whitespace fix 2024-02-01 16:32:31 +03:00
arencoskun c51a0b7454 Fix linter errors (hopefully) 2024-02-01 16:05:02 +03:00
arencoskun cae42772e8 Move function to CoreTerminal, add additional argument to specify if the input was user input or not. 2024-02-01 14:11:29 +03:00
arencoskun 09a0dd658d Final fixes 2024-02-01 13:11:54 +03:00
arencoskun bbd1a1dbe2 Try to fix linter errors 2024-02-01 13:05:13 +03:00
arencoskun f1e563ad5f Expose API method for writing to application side (#4948) 2024-02-01 11:17:25 +03:00
Daniel Imms 8e015ebf87 Merge pull request #4950 from Tyriar/tyriar/blending
Fix background selection blending for true color
2024-01-30 11:25:14 -08:00
Daniel Imms 3c88c767cd Fix background selection blending for true color
Bug in #4920
See microsoft/vscode#200428
2024-01-30 11:16:19 -08:00
jerch 99df13b085 Merge pull request #4937 from szymonkaliski/sk/fix-url-parsing
fix weblinks addon url parsing for url.encoded urls
2024-01-11 21:43:05 +01:00
Szymon Kaliski f03d870bcd adjust a comment 2024-01-11 11:23:24 -08:00
Szymon Kaliski 856666d5bd fix url parsing for urls with percentage sign in them 2024-01-05 09:43:33 +01:00
Daniel Imms 1940bbec75 Merge pull request #4931 from Tyriar/tyriar/out_ignore
Ignore out dirs in eslint
2023-12-30 09:30:46 -08:00
Daniel Imms 7b7fb73611 Ignore out dirs in eslint 2023-12-30 09:30:25 -08:00
Daniel Imms b97baa7ff1 Merge pull request #4930 from PerBothner/update-eslint
Update required eslint and eslint-plugin-jsdoc versions
2023-12-30 09:26:34 -08:00
Per Bothner a7bf3b22c1 Update required eslint and eslint-plugin-jsdoc versions
This fixes a problem when using node 20.*.*, because eslint-plugin-jsdoc@39.9.1
requires node version "^14 || ^16 || ^17 || ^18 || ^19".
2023-12-29 18:13:09 -08:00
Daniel Imms 442c1583e7 Merge pull request #4866 from silamon/remove-16-ci
Remove unit tests with Node 16
2023-12-29 04:14:20 -08:00
Daniel Imms 217acef6b2 Merge branch 'master' into remove-16-ci 2023-12-29 04:03:53 -08:00
Daniel Imms 0eed746638 Merge pull request #4878 from xtermjs/dependabot/npm_and_yarn/addons/addon-ligatures/axios-1.6.0
Bump axios from 0.21.2 to 1.6.0 in /addons/addon-ligatures
2023-12-29 04:02:51 -08:00
Daniel Imms 1b4f0606ca Merge pull request #4929 from Tyriar/tyriar/metrics
Implement and default to text metrics measure strategy
2023-12-29 04:02:04 -08:00
Daniel Imms 3c4d567be9 Merge pull request #4915 from tisilent/update-attachCustomWheelEventHandler-comments
Update attachCustomWheelEventHandler comments
2023-12-29 03:58:50 -08:00
Daniel Imms 82d50a4f89 Allow fit addon test to work when hidden 2023-12-29 03:57:37 -08:00
Daniel Imms 379c382fe7 Pull common measure parts into base class 2023-12-29 03:47:44 -08:00
Daniel Imms 559026bbf3 Implement and default to text metrics measure strategy
Fixes #3449
2023-12-29 03:40:44 -08:00
Daniel Imms 08e67a3a0b Merge pull request #4927 from Tyriar/tyriar/color
Move rgba.toColor to channels.toColor
2023-12-28 09:55:28 -08:00
Daniel Imms 1a82e0d421 Remove todo
Not much gain by caching the value
2023-12-28 09:47:05 -08:00
Daniel Imms 2e03680128 Add channels.toColor tests 2023-12-28 09:32:57 -08:00
Daniel Imms 94a9ce8566 Move toColor into channels
It operates on rgba channels, not a packed 32 bit int
2023-12-28 09:29:30 -08:00
Daniel Imms 6e351dd4ac Merge pull request #4924 from Tyriar/link_refactor
Split Linkifier2 (always active) into Linkifier (after attach) and LinkProviderService (always active)
2023-12-23 08:57:12 -08:00
Daniel Imms 53604e427b Update test-unit node to 18 2023-12-23 08:49:37 -08:00
Daniel Imms 1b52c97fd0 Add wait for builld job to test-unit 2023-12-23 08:46:09 -08:00
Daniel Imms dbcb43f1d3 Rename Linkifier2 -> Linkifier 2023-12-23 08:32:39 -08:00
Daniel Imms d7c8d063b6 Get linkifier test to work 2023-12-23 08:31:50 -08:00
Daniel Imms de41c9f306 Make linkifier always attached to dom 2023-12-23 08:29:28 -08:00
Daniel Imms 8733d2cfa2 Separate link provider service from linkifier 2023-12-23 08:21:35 -08:00
Daniel Imms b3737d6ff0 Merge pull request #4921 from Tyriar/tyriar/crosshair
Fix crosshair cursor now working in some embedders
2023-12-20 10:02:44 -08:00
Daniel Imms 56a6a010ab Fix crosshair cursor now working in some embedders
This was not happening in the demo because the xterm instance is almost
always focused.

See microsoft/vscode#199848
2023-12-20 07:28:26 -08:00
Daniel Imms 341d9f0597 Merge pull request #4920 from Tyriar/tyriar/bg_blend
Add bg+powerline background blend behavior
2023-12-19 08:57:03 -08:00
Daniel Imms a4505ed724 Skip another test on canvas 2023-12-19 08:47:54 -08:00
Daniel Imms b843e0fc8e Pass through dom skip exceptions flag 2023-12-19 08:44:14 -08:00
Daniel Imms c0fac5e5f1 Fix test suppression 2023-12-19 08:38:55 -08:00
Daniel Imms 78a945ae9e Suppress test failure 2023-12-19 08:34:16 -08:00
Daniel Imms 9b62849bb8 Fix lint 2023-12-19 08:23:21 -08:00
Daniel Imms 66b426311e Fix compile 2023-12-19 08:21:18 -08:00
Daniel Imms 7bee001868 Ensure addons are loaded in standalone tests 2023-12-19 08:18:44 -08:00
Daniel Imms 22f1ce4a11 Add bg+powerline background blend behavior
When a with bg is selected, the cell's regular background will be blended
with 50% opacity selectionBackground in order to retain the bg color info
as well as getting the color to change and getting decent contrast.

This commit also fixes a terrible, nasty bug where the standalone shared
renderer tests were causing the terminal to open multiple times and not
get the WebGL addon activated the second time. So some tests were actually
testing the DOM renderer :o

Fixes #4918
2023-12-19 08:16:48 -08:00
Daniel Imms 805823df7a Merge pull request #4919 from Tyriar/tyriar/noisy
Remove tracing drawToCache call
2023-12-19 05:50:32 -08:00
Daniel Imms 7c5ad6b7a9 Remove tracing drawToCache call
This was a little noisy and didn't end up being that useful
2023-12-19 05:44:55 -08:00
Daniel Imms 0904078bf4 Merge pull request #4912 from jeanp413/fix-vscode-200469
Fixes vscode #200469
2023-12-15 08:26:27 -08:00
Jean Pierre 9f995c6ff8 💄 2023-12-15 16:03:37 +00:00
tisilent 427b4f6c6d Update attachCustomWheelEventHandler comments 2023-12-14 16:55:49 +08:00
jeanp413 81a4d860c5 💄 2023-12-12 09:21:55 -05:00
jeanp413 7ac95fab28 More fixes 2023-12-12 09:19:53 -05:00
Daniel Imms 1f15c47a43 Merge pull request #4913 from Tyriar/tyriar/wheel_handlers
addCustomWheelEventHandler API
2023-12-12 05:25:31 -08:00
Daniel Imms 88ba66d00b addCustomWheelEventHandler API
I opted for consistency with the key event handler over our more modern
approach, we can migrate them at the same time if we end up returning
a disposable.

See microsoft/vscode#76381
2023-12-12 05:17:24 -08:00
jeanp413 2592e1e84d re register intersection observer on window change 2023-12-12 05:55:30 -05:00
jeanp413 97750f672f 💄 2023-12-12 04:41:20 -05:00
jeanp413 54608bf38d Fixes https://github.com/microsoft/vscode/issues/200469 2023-12-12 04:16:28 -05:00
Daniel Imms b4226bc0f5 Merge pull request #4910 from Tyriar/tyriar/leaks
Help embedders avoid memory leaks by clearing options
2023-12-08 12:19:42 -08:00
Daniel Imms 1943636f02 Help embedders avoid memory leaks by clearing options
Related microsoft/vscode#192838
2023-12-08 12:14:22 -08:00
dependabot[bot] d218bff2c4 Bump axios from 0.21.2 to 1.6.0 in /addons/addon-ligatures
Bumps [axios](https://github.com/axios/axios) from 0.21.2 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.21.2...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-10 16:12:08 +00:00
Daniel Imms fb2c39cb57 Merge pull request #4877 from Tyriar/serialize_fixes
Add range API to serialize addon
2023-11-09 10:27:54 -08:00
Daniel Imms b595940bcf Add range API to serialize addon
Fixes #4876
Fixes #4871
2023-11-09 09:43:14 -08:00
Daniel Imms 49eab6b1d9 Merge pull request #4874 from tisilent/dashed-line
Draw dashed lines through ratios
2023-11-08 05:30:00 -08:00
tisilent 2861a4dd39 Draw dashed lines through ratios 2023-11-08 17:58:38 +08:00
Simon Lamon b4fa7c6c06 Remove unit tests with Node 16 2023-11-04 14:35:36 +01:00
Daniel Imms 58bb7fc73e Merge pull request #4742 from JasonXJ/sync-select
Allow selection in the a11y tree and sync the selection to terminal
2023-11-03 09:08:53 -07:00
Daniel Imms b16724f06a Improve docs of BufferLine.translateToString 2023-11-03 08:53:53 -07:00
Daniel Imms 5630239a6d Merge remote-tracking branch 'upstream/master' into pr/JasonXJ/4742 2023-11-03 08:47:05 -07:00
Daniel Imms 13be985b36 Merge pull request #4825 from PerBothner/setcell-refactor
Change setCellFromCodePoint API and rename to setCellFromCodepoint
2023-11-03 06:00:35 -07:00
Daniel Imms a5646a58d5 Merge pull request #4801 from tisilent/fix-inactive-cursor-spot
using viewport relative coordinate
2023-11-02 11:21:29 -07:00
Daniel Imms b0407e20cf Merge branch 'master' into setcell-refactor 2023-11-02 11:17:18 -07:00
Daniel Imms 8a1790d6d5 Merge remote-tracking branch 'upstream/master' into pr/tisilent/4801 2023-11-02 11:13:00 -07:00
Daniel Imms 86074c9210 Merge pull request #4703 from tisilent/underline-dotted
Use variants for underline dotted.
2023-11-02 10:55:00 -07:00
Daniel Imms 2f074b87f3 Explain VARIANT_OFFSET 2023-11-02 10:45:46 -07:00
Daniel Imms 6214f4c2e6 Varinat -> Variant 2023-11-02 10:43:56 -07:00
Daniel Imms 390e4f30c8 Merge remote-tracking branch 'upstream/master' into pr/tisilent/4703 2023-11-02 10:39:15 -07:00
Daniel Imms 4036ab7055 Merge pull request #4837 from tisilent/fix-dom-renderer-selection
handle selection when resizing
2023-11-02 09:43:09 -07:00
Daniel Imms 139bf361b4 Merge pull request #4836 from xiaoxiaobt/safari-legacy-fix
Allow xterm.js to run on legacy versions of Safari when Webgl2 support is explicitly enabled
2023-11-02 09:32:41 -07:00
Daniel Imms c9f15454e4 Merge pull request #4833 from arcanis/patch-3
Fixes hex color serialization
2023-11-02 09:30:48 -07:00
Daniel Imms b6a09d67e2 Merge remote-tracking branch 'upstream/master' into pr/tisilent/4837 2023-11-02 09:30:17 -07:00
Daniel Imms 1770bb1b65 Merge pull request #4839 from JasonXJ/ctrl-backspace
Send correct code for ctrl+[alt+]+backspace
2023-11-02 09:28:06 -07:00
Daniel Imms 52549f0a7a Merge remote-tracking branch 'upstream/master' into pr/arcanis/4833 2023-11-02 09:24:33 -07:00
Daniel Imms 0d7cc9e9fd Merge branch 'master' into safari-legacy-fix 2023-11-02 09:08:41 -07:00
Daniel Imms e8da73799f Merge pull request #4847 from tisilent/add-addon-public-api
Have addons implement their API at compile time
2023-11-02 09:08:14 -07:00
Daniel Imms 588da4f3b8 Merge remote-tracking branch 'upstream/master' into pr/xiaoxiaobt/4836 2023-11-02 09:00:28 -07:00
Daniel Imms 4beb7d0595 Make addon api imports consistent 2023-11-02 08:54:49 -07:00
Daniel Imms 4c275a287f Fix paths in benchmark tsconfigs 2023-11-02 08:52:09 -07:00
Daniel Imms 5ed2b013d5 Merge remote-tracking branch 'upstream/master' into pr/tisilent/4847 2023-11-02 08:45:11 -07:00
Daniel Imms 19bdcab93e Merge pull request #4862 from Tyriar/image_publish
Fix image addon build
2023-11-01 14:29:43 -07:00
Daniel Imms 45e7efce67 Re-enable auth 2023-11-01 14:29:32 -07:00
Daniel Imms fbc51ae691 Remove logs 2023-11-01 14:24:38 -07:00
Daniel Imms 92eb78230b Verify it's not an array 2023-11-01 14:17:31 -07:00
Daniel Imms 31925596f1 Log publish script 2023-11-01 13:15:28 -07:00
Daniel Imms 88b0b4a5c7 Log publish script 2023-11-01 13:07:59 -07:00
Daniel Imms c8b2783b85 Tweak parsing versions 2023-11-01 13:01:20 -07:00
Daniel Imms 2744549c0f Return [] if versionsJson is falsy 2023-11-01 12:35:25 -07:00
Daniel Imms 1c522e16a4 Fix image addon build
Fixes #4761
Fixes #4802
2023-11-01 12:13:19 -07:00
Daniel Imms 4b2e52f13c Merge pull request #4861 from Tyriar/scope_followup
Uncomment first publish special cases, add missing (at)xterm
2023-11-01 12:03:56 -07:00
Daniel Imms bbbde9261f Fix parsing of low version count 2023-11-01 11:59:42 -07:00
Daniel Imms eac8124320 Fix stable release check 2023-11-01 11:27:04 -07:00
Daniel Imms 64534e1b7a Fix missing peer dep 2023-11-01 11:07:41 -07:00
Daniel Imms 71ec216161 Uncomment first publish special cases, add missing (at)xterm
Part of #4859
2023-11-01 11:06:30 -07:00
Daniel Imms 2df591c5f7 Merge pull request #4860 from Tyriar/scoped_package
Start @xterm scope with core and webgl addons
2023-11-01 10:55:31 -07:00
Daniel Imms d95f0177c8 Add todo comments for uncomment publish script 2023-11-01 10:49:21 -07:00
Daniel Imms b4b128709f Add other addons to the readme addon section 2023-11-01 10:37:20 -07:00
Daniel Imms 0fd04aa76d Replace all instances of xterm-addon 2023-11-01 10:35:10 -07:00
Daniel Imms 4abb4c674f Use build artifacts in dry run 2023-11-01 07:31:39 -07:00
Daniel Imms 485fb455d6 Add release dry run job to CI 2023-11-01 07:29:42 -07:00
Daniel Imms 765a8b21a3 real run 2023-11-01 07:25:58 -07:00
Daniel Imms dcc940c32e headless -> scoped 2023-11-01 07:24:49 -07:00
Daniel Imms 059acb2da6 Handle versionsJson error 2023-11-01 07:22:28 -07:00
Daniel Imms a1f87809b2 Log versionsJson 2023-11-01 07:19:23 -07:00
Daniel Imms 2fb9702a3a Force dry run temporarily 2023-11-01 07:14:19 -07:00
Daniel Imms 5196ac5c8f Fix variable name 2023-11-01 07:02:14 -07:00
Daniel Imms 9db2178d05 Return [] when no versions are published 2023-11-01 07:00:23 -07:00
Daniel Imms 8c6d16486d Don't fetch beta versions 2023-11-01 06:57:44 -07:00
Daniel Imms cef869a206 Force beta build for now 2023-11-01 06:55:21 -07:00
Daniel Imms efbcd41fab from xterm-headless -> from scoped 2023-11-01 06:50:48 -07:00
Daniel Imms bb9728ccd1 from xterm -> from scoped 2023-11-01 06:50:08 -07:00
Daniel Imms 905285efda Temporarily enable publishing in PRs 2023-11-01 06:48:33 -07:00
Daniel Imms e1d19e00a5 Merge remote-tracking branch 'upstream/master' into scoped_package 2023-11-01 06:46:14 -07:00
Daniel Imms add7f8133e Start @xterm scope with core and webgl addons 2023-11-01 06:44:26 -07:00
Daniel Imms 33100818d7 Merge pull request #4831 from tisilent/fix-search-options-change
Check option changes
2023-10-31 06:49:50 -07:00
Daniel Imms 974b275f6e is -> did 2023-10-31 06:41:41 -07:00
Daniel Imms ea2d775595 Merge branch 'master' into fix-search-options-change 2023-10-31 06:38:24 -07:00
Daniel Imms f741d42165 Merge pull request #4858 from xtermjs/Tyriar-patch-1
Remove unicode-graphemes install doc
2023-10-31 06:29:02 -07:00
Daniel Imms 6945e881a8 Update README.md 2023-10-31 06:18:40 -07:00
Daniel Imms 804ff187fa Merge pull request #4856 from alan-agius4/alan-agius4-patch-1
fix: use globalThis instead of self to address non Browser consumption
2023-10-30 09:36:08 -07:00
Alan Agius de1304d19e fix: use globalThis instead of self to address non Browser consumption
Currently using this package in a non Browser env will cause an error as Webpack will emit `self` which does not exist in all envs such as Node.js and Workers.

This commit updates Webpack and force it to use `globalThis`. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
2023-10-30 10:44:18 +01:00
Daniel Imms 9fff1e6e44 Merge pull request #4851 from davidfiala/fix-xterm-node21
proper isNode detection for node v21.0.0
2023-10-19 11:38:49 -07:00
David Fiala 0d0166b4bc provide a declaration for 'process' needed for nodejs detect
We provide no further type information as it will not be used except for a presence check for nodejs detection.
2023-10-19 11:19:27 -07:00
David Fiala 6c5fb36c36 proper isNode detection for node v21.0.0 2023-10-19 09:52:29 -07:00
Daniel Imms 1c880f5199 Merge pull request #4849 from xtermjs/dependabot/npm_and_yarn/babel/traverse-7.23.2
Bump @babel/traverse from 7.22.8 to 7.23.2
2023-10-19 09:39:44 -07:00
dependabot[bot] 4681b319ca Bump @babel/traverse from 7.22.8 to 7.23.2
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.8 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-19 11:47:16 +00:00
Daniel Imms 78a6aac409 Merge pull request #4846 from Tyriar/multi_window
Make xterm.js multi-window aware
2023-10-17 11:03:31 -07:00
Daniel Imms 20a26a6589 Remove unused imports 2023-10-17 10:54:29 -07:00
tisilent a4e09d0ad8 add path to benchmark 2023-10-18 01:09:39 +08:00
tisilent dfd5385602 add semicolon 2023-10-18 00:49:29 +08:00
tisilent 7dab4601d2 add public api 2023-10-18 00:29:56 +08:00
Daniel Imms 81e0718a74 Move window resize edge case into dpr monitor 2023-10-17 09:18:46 -07:00
Daniel Imms 6e12d94f11 Move window resize listeners over to onWindowChange 2023-10-17 09:10:04 -07:00
Daniel Imms 92535e539f Inline ScreenDprMonitor into CoreBrowserService file 2023-10-17 08:56:02 -07:00
Daniel Imms 4cc51ca08f Move ScreenDprMonitor into CoreBrowserService 2023-10-17 08:55:07 -07:00
Daniel Imms 63790f8854 Change ScreenDprMonitor to be event based 2023-10-17 08:49:28 -07:00
Daniel Imms 45605db3c5 Listen to window change and pass through to ScreenDprMonitor 2023-10-17 08:39:48 -07:00
Daniel Imms c80453f602 Use correct document when creating elements 2023-10-16 11:09:36 -07:00
tisilent eb4277e7bd using ITerminal 2023-10-16 09:35:21 +08:00
Daniel Imms 4245283e05 Merge pull request #4844 from Tyriar/doc_override
Expose a documentOverride setting
2023-10-13 13:48:58 -07:00
Daniel Imms 41c62288f0 Expose a documentOverride setting
This lets the embedder choose which Document object to use for creating
elements, adding event listeners, etc. The reason this exists is because
when working with multiple windows it can be convenient to create all
elements under the primary window to make instanceof usage consistent.

See microsoft/vscode#195595
2023-10-13 13:41:53 -07:00
Jason Lin c3aa63cffa translateToString() adds one more entry to outColumns
Previously, for string 'ab好', outColumns=[0, 1, 2]. Now it becomes [0,
1, 2, 4]. This allows the user to know where does the last character
ends.
2023-10-11 16:23:03 +11:00
Jason Lin 1b940de0bf Allow selection in the a11y tree and sync the selection to terminal 2023-10-11 16:23:03 +11:00
Jason Lin 023c778c4d Send correct code for ctrl+[alt+]+backspace
We should send ^H (instead of ^?) for ctrl+backspace. This is what xterm
and gnome-terminal do.
2023-10-11 14:59:35 +11:00
tisilent 6b5fc260ca Dom Renderer using SelectionRenderModel 2023-10-10 22:53:01 +08:00
tisilent d3e075f37b handle selection when resizing 2023-10-10 15:54:15 +08:00
Taige Wang 194b810ad5 Fix Webgl2 compatability on legacy Safari with webgl2 enabled 2023-10-08 13:03:28 +03:00
Maël Nison 7cbaacde40 Fixes hex color serialization 2023-10-04 15:42:02 +02:00
Daniel Imms 34017f32fb Merge pull request #4829 from xtermjs/dependabot/npm_and_yarn/get-func-name-2.0.2
Bump get-func-name from 2.0.0 to 2.0.2
2023-10-02 11:22:58 -07:00
Daniel Imms 57e2adc042 Merge branch 'master' into dependabot/npm_and_yarn/get-func-name-2.0.2 2023-10-02 11:16:37 -07:00
Daniel Imms e9390d0d91 Merge pull request #4832 from Tyriar/node-pty-update
node-pty@1.1.0-beta5
2023-10-02 11:14:14 -07:00
Daniel Imms f6c4aee928 Move benchmarks off removed node-pty apis 2023-10-02 11:05:33 -07:00
Daniel Imms a673b110f5 node-pty@1.1.0-beta5
This is needed to get the build working on the newly updated GH actions runners
2023-10-02 07:27:10 -07:00
tisilent cfde4d634f Check option changes 2023-10-01 20:39:10 +08:00
Per Bothner 4e4110aeb4 Merge branch 'master' into setcell-refactor 2023-09-28 10:46:03 -07:00
dependabot[bot] 4149aa0945 Bump get-func-name from 2.0.0 to 2.0.2
Bumps [get-func-name](https://github.com/chaijs/get-func-name) from 2.0.0 to 2.0.2.
- [Release notes](https://github.com/chaijs/get-func-name/releases)
- [Commits](https://github.com/chaijs/get-func-name/commits/v2.0.2)

---
updated-dependencies:
- dependency-name: get-func-name
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-27 21:02:12 +00:00
Daniel Imms 810cc1d47e Merge pull request #4827 from Tyriar/tyriar/4821
Bring back search clearActiveDecoration
2023-09-27 08:04:30 -07:00
Daniel Imms c08062420f Bring back search clearActiveDecoration
This was removed accidentally in 57db72d

Fixes #4821
2023-09-27 07:56:31 -07:00
Per Bothner bde7bdc11d Change setCellFromCodePoint API and rename to setCellFromCodepoint
Replace fg, bg, and eAttrs parameters by single IAttributeData parameter.
In addition to making for a simpler/cleaner API, it also increases flexibility
for future CellData or BufferLine changes.
(Rename function to reduce risk of using accidentally using old function.)

Also removed redundant eraseAttr parameter in deleteCells, insertCells, and replaceCells.
2023-09-25 18:21:02 -07:00
Daniel Imms a3e933d98b Merge pull request #4820 from Tyriar/4814
Don't re-render after parse is the viewport did not change
2023-09-20 06:51:08 -07:00
Daniel Imms 543b82567f Don't re-render after parse is the viewport did not change
Fixes #4814
2023-09-20 06:43:21 -07:00
Daniel Imms cfc94b332a Merge pull request #4816 from tisilent/fix-domrenderer-selection-overflow
Add column restriction
2023-09-20 06:06:43 -07:00
tisilent f391cf6d43 Add column restriction 2023-09-20 18:40:03 +08:00
tisilent da2687174f 💄 2023-09-19 22:49:53 +08:00
tisilent a8ef1d49a1 Add block cursor style confirmation 2023-09-19 22:15:35 +08:00
tisilent feb75a7f4d Add getCellColorFirstPoint function 2023-09-19 21:58:08 +08:00
tisilent 27fd011e35 Add regression tests 2023-09-19 20:29:28 +08:00
Daniel Imms 03f1336042 Merge pull request #4809 from silamon/correct-typing-graphemes
Correct graphemes addon readme and typings
2023-09-16 07:36:31 -07:00
Simon Lamon fbf7d7adb5 Fix typos in readme 2023-09-16 08:09:22 +00:00
Simon Lamon da041f43ee correct typing graphemes 2023-09-16 08:04:32 +00:00
Daniel Imms a6f57262f6 Merge pull request #4807 from mofux/isolate-width-cache-element
Move WidthCache measure container to helper container
2023-09-15 07:45:15 -07:00
Daniel Imms aa5ec44c27 Merge pull request #4808 from tisilent/#4736-add-regression-test
Add regression test,checking inactive selection.
2023-09-15 04:31:30 -07:00
Daniel Imms 446549a043 Tweak name, order in issue number 2023-09-15 04:23:47 -07:00
tisilent ef21ed901f Add regression test,checking inactive selection. 2023-09-15 18:57:17 +08:00
Thomas Zilz aaadefa548 Move WidthCache measure container to helper container 2023-09-15 10:51:31 +02:00
Daniel Imms 0e66d608a1 Merge pull request #4803 from tisilent/clear-repeat-overviewRulerWidth
Clear repeat overviewRulerWidth option in demo
2023-09-14 12:52:44 -07:00
Daniel Imms 1618092b91 Merge pull request #4798 from tisilent/fix-domrenderer-isCursorInitialized
using isCursorInitialized for domrenderer
2023-09-14 12:41:30 -07:00
Daniel Imms 2f9439b690 Explain injectSharedRendererTestsStandalone 2023-09-14 12:35:12 -07:00
Daniel Imms 66c8e33b47 Add standalone renderer tests to canvas/webgl 2023-09-14 12:33:34 -07:00
tisilent 9048ded5eb Clear repeat overviewRulerWidth option in demo 2023-09-14 17:26:30 +08:00
tisilent 17575e1d7b using viewport relative coordinate 2023-09-14 16:37:40 +08:00
tisilent 49dc046b9f rename and remove new page 2023-09-14 09:52:58 +08:00
tisilent 27d89c2311 Reduce side effects 2023-09-14 00:47:37 +08:00
tisilent 871400f407 Open a new page to perform testing. 2023-09-13 23:28:37 +08:00
tisilent a1229c78a2 Add cursor initialize test 2023-09-13 18:43:04 +08:00
tisilent 457060f89d Modify the isCursorInitialized default true 2023-09-13 18:15:37 +08:00
tisilent cc14bc4515 using isCursorInitialized for domrenderer 2023-09-13 17:34:31 +08:00
Daniel Imms bdb25c2dbe Merge pull request #4519 from PerBothner/clusters
New unicode-graphemes addon.
2023-09-12 13:56:27 -07:00
Daniel Imms 32c616512d Final polish 2023-09-12 12:45:29 -07:00
Daniel Imms 16bd8de78e Merge pull request #4796 from Tyriar/slow_trace
Remove noisy trace calls
2023-09-12 12:38:48 -07:00
Daniel Imms 3ad0ef1ac4 Remove noisy trace calls
These were added to try diagnose a rendering issue but I haven't had
reports yet and these logs slow the terminal to a crawl which is
impacting my patience/productivity
2023-09-12 12:31:36 -07:00
Daniel Imms cb8917557d Merge pull request #4795 from ujjwalpandey922/master
change repository URL of all addons
2023-09-12 09:07:00 -07:00
Daniel Imms 8183d1d221 Merge branch 'master' into clusters 2023-09-12 09:02:24 -07:00
Daniel Imms 9ab0cd648e Set repository to sub-directory
See #4795
2023-09-12 09:02:15 -07:00
Ujjwal Pandey 249e1152f4 remove gitpod file 2023-09-12 15:44:17 +00:00
Ujjwal Pandey d41b747aa1 change repository url of all addons 2023-09-12 14:59:08 +00:00
Megan Rogge f69fcb971c get voiceover to announce terminal output consistently (#4789)
* fix #3247

* rm import
2023-09-11 13:03:57 -05:00
Daniel Imms bfa6f656ef Merge branch 'master' into underline-dotted 2023-09-11 08:47:04 -07:00
Daniel Imms 24b932d67a Update to es2021 2023-09-11 06:34:32 -07:00
Daniel Imms 9e536ca9c3 Fix warnings in client.ts 2023-09-11 06:28:54 -07:00
Daniel Imms 17c4d097bb Add experimental note in readme 2023-09-11 06:06:58 -07:00
Daniel Imms 1b5756c1b1 Add unicode-grapheme addon files to build artifacts 2023-09-11 06:04:55 -07:00
Daniel Imms a003034b02 Increase node memory for lint in CI 2023-09-11 06:02:17 -07:00
Per Bothner bddff604c2 Merge branch 'master' into clusters 2023-09-10 17:20:40 -07:00
Daniel Imms b2c123e0e2 Merge pull request #4787 from Tyriar/pw_tweak
Tweak playwright workers
2023-09-10 09:04:27 -07:00
Daniel Imms be82ffc01d Merge pull request #4786 from Tyriar/4773
Fix block cursor rendering in DOM renderer
2023-09-10 09:00:45 -07:00
Daniel Imms efcca3fb3e Run pw tests faster on high core machines 2023-09-10 08:56:36 -07:00
Daniel Imms b91de01a4d Fix initial args not being passed through to pw 2023-09-10 08:56:19 -07:00
Daniel Imms 6b1c1e0751 Force 50% workers in CI to reduce flakiness 2023-09-10 08:56:04 -07:00
Daniel Imms 8985326dd8 Merge pull request #4743 from Tyriar/es2021
Upgrade es6 -> es2021
2023-09-10 08:33:48 -07:00
Daniel Imms c609f5cca0 Add regression test for block cursor focus/selection 2023-09-10 08:30:43 -07:00
Daniel Imms 3b15fb6211 Fix block cursor rendering in DOM renderer
Fixes #4773
2023-09-10 08:27:18 -07:00
Daniel Imms a7eb112d36 Merge pull request #4785 from Tyriar/4757
Fix possible exception when disposing terminal
2023-09-10 08:26:22 -07:00
Daniel Imms cc43fe5191 Fix possible exception when disposing terminal
Fixes #4757
2023-09-10 08:19:46 -07:00
Daniel Imms cfced0caf1 Merge pull request #4784 from Tyriar/server-debug
Fix server debugging
2023-09-10 07:52:45 -07:00
Daniel Imms fc18e6e774 Merge pull request #4783 from Tyriar/4781
Fix regression in force mouse selection
2023-09-10 07:48:55 -07:00
Daniel Imms 1d57ac5c63 Fix server debugging
This broke somewhere along the way, the changes update from the legacy
attach method of --inspect-brk to stopOnEntry and also updates for the
introduction of .nvmrc.
2023-09-10 07:46:00 -07:00
Daniel Imms b55d699451 Fix regression in force mouse selection
Shift+left click is means to force terminal selection and not passthrough
any mouse events, even if a mouse mode is enabled. The change this is
reverting from #4583 caused this feature to break by always installing a
global listener on Terminal.element so the SelectionService never got a
chance to cancel is.

Fixes #4781
2023-09-10 07:41:31 -07:00
Daniel Imms 4241704261 Merge pull request #4782 from Tyriar/edge_debug
Add edge debug target
2023-09-10 07:24:21 -07:00
Daniel Imms b50d21434e Add edge debug target 2023-09-10 07:23:54 -07:00
Daniel Imms c3fd1c2c40 Merge pull request #4778 from Tyriar/4759
Fix webgl/dom inverse MCR edge cases, add regression test
2023-09-09 09:08:33 -07:00
Daniel Imms fe4528c9be Add one regression test to canvas exceptions 2023-09-09 09:00:57 -07:00
Daniel Imms b0868967cb Fix inverse MCR with selection for dom renderer
Fixes #4759
2023-09-09 08:52:43 -07:00
Daniel Imms 1aac37e14f Improve regression tests for 4759 2023-09-09 08:51:50 -07:00
Daniel Imms 851c2e39af Fix webgl not respecting MCR for inverse
Part of #4759
2023-09-09 08:37:55 -07:00
Daniel Imms d2387342ce Merge pull request #4777 from Tyriar/4769
Fix MCR test on webkit, add pollForApproximate
2023-09-09 07:52:47 -07:00
Daniel Imms 1792eaf05f Fix MCR test on webkit, add pollForApproximate
Fixes #4769
2023-09-09 07:45:31 -07:00
Daniel Imms 36bf3ebff3 Merge pull request #4776 from Tyriar/4775
Fix viewport error during term dispose
2023-09-09 07:20:03 -07:00
Daniel Imms 681ba4887f Fix viewport error during term dispose
Fixes #4775
2023-09-09 07:11:32 -07:00
Daniel Imms b7f28c56a9 Merge pull request #4774 from Tyriar/4772
Avoid block elements in renderer tests
2023-09-09 06:57:31 -07:00
Daniel Imms 575cd8d28b Avoid block elements in renderer tests
Fixes #4772
2023-09-09 06:51:13 -07:00
Daniel Imms 3d440e21bd Merge pull request #4763 from tisilent/fix-selection-background-domrenderer
DomRenderer draw selection inactive background correctly when unfocused
2023-09-09 06:37:00 -07:00
Daniel Imms a10113543b Check add empty cells that are being asserted on 2023-09-09 06:28:07 -07:00
Daniel Imms 50369713de Merge branch 'master' into fix-selection-background-domrenderer 2023-09-09 06:16:42 -07:00
Daniel Imms 2f2154c13b Merge pull request #4762 from tisilent/Fix-Domrenderer-Invisible
Add handling of invisible
2023-09-09 06:16:16 -07:00
Daniel Imms 056206d7a4 Clear theme at start of every renderer test 2023-09-09 06:09:07 -07:00
Daniel Imms 57ab29bb85 Handle canvas renderer's more delayed rendering 2023-09-09 06:02:32 -07:00
Daniel Imms 4e69307074 Add regression test 2023-09-09 05:59:24 -07:00
Daniel Imms 608a5e2329 Merge branch 'master' into Fix-Domrenderer-Invisible 2023-09-09 04:58:39 -07:00
Daniel Imms 5126481de2 Remove only 2023-09-09 04:55:56 -07:00
Daniel Imms fa168bd4c0 Add a test which fails without the change 2023-09-08 20:21:58 -07:00
Daniel Imms f159a862e4 Add default xterm.js theme inactive selection bg 2023-09-08 19:57:17 -07:00
Daniel Imms 9f5ff468e1 Remove selection color test buttons
There's too many theme colors, we'll leave it to the console
2023-09-08 19:55:25 -07:00
Daniel Imms 65e07dcebc Merge branch 'master' into fix-selection-background-domrenderer 2023-09-08 19:50:29 -07:00
Daniel Imms cc83b9a4ca Merge pull request #4770 from Tyriar/tyriar/canvas_tests
Add canvas renderer tests
2023-09-08 14:27:38 -07:00
Daniel Imms 14872e091e Revert "Avoid importing os"
This reverts commit 2d74505208.
2023-09-08 14:21:18 -07:00
Daniel Imms 3d3f58b6ff Have playwright addon tests only start server, not build it 2023-09-08 14:10:37 -07:00
Daniel Imms b99158f8f0 Add workers back to playwright ci 2023-09-08 13:30:27 -07:00
Daniel Imms 2d74505208 Avoid importing os 2023-09-08 13:26:10 -07:00
Daniel Imms 534b03b99f Revert "Put webgl first"
This reverts commit 4af4d8dcc6.
2023-09-08 13:19:29 -07:00
Daniel Imms 4af4d8dcc6 Put webgl first 2023-09-08 13:12:49 -07:00
Daniel Imms 298c5b2041 Split up playwright suites into steps 2023-09-08 13:09:47 -07:00
Daniel Imms 328e97336b Try space out suites 2023-09-08 12:58:33 -07:00
Daniel Imms 2e10a7f097 Add window prefer to global symbols 2023-09-08 12:42:26 -07:00
Daniel Imms 1798cab222 Remove webgl canvas check
It complicates loading the addon
2023-09-08 12:37:53 -07:00
Daniel Imms ebd27de4e1 Re-enable core tests 2023-09-08 12:31:27 -07:00
Daniel Imms beeff131a9 Disable canvas tests on webkit 2023-09-08 12:28:08 -07:00
Daniel Imms 408240dd97 Tweak canvas renderer test 2023-09-08 12:22:38 -07:00
Daniel Imms 71eb897708 Add npm start to canvas 2023-09-08 12:17:22 -07:00
Daniel Imms 02aadf7c3e Remove firefox exception from canvas 2023-09-08 12:17:00 -07:00
Daniel Imms 98e8c6ac73 Add canvas renderer tests 2023-09-08 12:16:16 -07:00
Daniel Imms 34933d2c76 Merge pull request #4768 from Tyriar/renderer_pw
DOM renderer playwright tests
2023-09-08 11:36:39 -07:00
Daniel Imms a0c34b19df Skip webgl tests on linux/firefox 2023-09-08 10:52:21 -07:00
Daniel Imms 48ba5e5856 Add npm start to webgl package.json 2023-09-08 10:35:38 -07:00
Daniel Imms 47183b2939 Fix relative path 2023-09-08 10:31:30 -07:00
Daniel Imms 9b9062aea4 Run npm start using relative cwd 2023-09-08 10:27:14 -07:00
Daniel Imms cdf02d54da Share test code between dom and webgl 2023-09-08 10:22:13 -07:00
Daniel Imms 413e884efb Use faster pixel check method with caching 2023-09-08 10:12:06 -07:00
Daniel Imms 070d194c6c Migrate webgl to playwright/test, add unified runner script 2023-09-08 10:04:25 -07:00
Daniel Imms e54755b074 Skip failure on WebKit 2023-09-08 08:37:06 -07:00
Daniel Imms db608e33fb Fix remaining dom renderer tests 2023-09-08 08:26:49 -07:00
Daniel Imms b543842fc0 Fix dom MCR tests 2023-09-08 08:23:20 -07:00
Daniel Imms 97be015234 All tests copied over, some failing 2023-09-08 08:08:45 -07:00
Daniel Imms a656409bb5 All color dom renderer tests 2023-09-08 08:04:36 -07:00
Daniel Imms ea45b04105 First working dom renderer api tests
Part of #4767
2023-09-08 07:47:14 -07:00
Daniel Imms 66a6ecea14 Improve playwright debug logging 2023-09-08 07:46:45 -07:00
Daniel Imms f23af3661b wip 2023-09-08 07:28:41 -07:00
tisilent 2f233f2389 💄 2023-09-08 18:52:11 +08:00
tisilent 393a8b3a86 When DomRenderer blue,perform rendering. 2023-09-08 18:08:14 +08:00
tisilent c64115e0a0 Add handling of invisible 2023-09-08 17:34:03 +08:00
Per Bothner 427c472f6f Merge branch 'master' into clusters 2023-09-07 12:01:56 -07:00
Daniel Imms 2e02c37e52 Merge pull request #4756 from Tyriar/tyriar/5_3__2
Disable image addon publishing
2023-09-07 10:58:11 -07:00
Daniel Imms 71ee3c7a33 Disable image addon publishing 2023-09-07 10:57:21 -07:00
Daniel Imms 009add2b4a Merge pull request #4755 from Tyriar/tyriar/5_3
v5.3.0 and bump all addons
2023-09-07 10:54:11 -07:00
Daniel Imms fb4b662756 v5.3.0 and bump all addons 2023-09-07 10:46:35 -07:00
Daniel Imms c1882eb1ff Merge branch 'master' into es2021 2023-09-07 10:03:17 -07:00
Per Bothner 9963c58511 Two testing-related fixes 2023-09-07 09:49:37 -07:00
Daniel Imms 7b52b8ee45 Merge pull request #4754 from tisilent/DomRenderer-Focus-Cursor
When DomRenderer focus,render the cursor line.
2023-09-07 08:53:26 -07:00
tisilent c03cb2b016 When DomRenderer focus,render the cursor line. 2023-09-07 23:44:36 +08:00
Per Bothner 930e5c4280 Merge branch 'master' into clusters 2023-09-06 22:11:46 -07:00
Per Bothner 630d213bd0 Fix 2 comment typos. 2023-09-06 16:42:58 -07:00
Daniel Imms 82b6dd1ac8 Merge branch 'master' into es2021 2023-09-03 07:20:20 -07:00
Daniel Imms 29dd30a98d Merge pull request #4735 from Tyriar/playwright
Start @playwright/test migration
2023-09-03 07:19:20 -07:00
Daniel Imms 68c572345b Remove debugger statement 2023-09-02 09:19:17 -07:00
Daniel Imms 5e628d7fc6 Use arrow functions 2023-09-02 09:11:15 -07:00
Daniel Imms 93aae670ba Readme explaining test/api 2023-09-02 08:56:59 -07:00
Daniel Imms 7c7ac86681 Run inner pwsh to unzip on Winodws 2023-09-02 08:53:20 -07:00
Daniel Imms 076ab0f49b Combine unzip and ls -R 2023-09-02 08:44:32 -07:00
Daniel Imms 5fc1c04bd6 Use bash on all OS' 2023-09-02 08:41:59 -07:00
Daniel Imms 525d498e9f Fix unzip on Windows 2023-09-02 08:40:57 -07:00
Daniel Imms 2b5ebb2b7b Use unified unzip on unit tests 2023-09-02 08:33:01 -07:00
Daniel Imms 2269e92c88 Fix syntax 2023-09-02 08:30:51 -07:00
Daniel Imms 7c434a0566 Merge unzip steps 2023-09-02 08:30:14 -07:00
Daniel Imms 31bbeca2d8 Add webkit 2023-09-02 08:26:46 -07:00
Daniel Imms 158f7a17a6 Use list reporter 2023-09-02 08:26:42 -07:00
Daniel Imms 8d0fde2d7f Remove only 2023-09-02 08:22:56 -07:00
Daniel Imms 4cd4597082 Browser-specific playwright job 2023-09-02 08:19:59 -07:00
Daniel Imms 1624854bd7 Migrate Terminal api tests to playwright 2023-09-02 08:18:02 -07:00
Daniel Imms c099cb2a3d Add browser-specific npm scripts 2023-09-02 08:17:15 -07:00
Daniel Imms 1c57b98c9a Migrate InputHandler api tests to playwright 2023-09-02 07:19:32 -07:00
Daniel Imms a29ab32876 Migrate MouseTracking api tests to playwright 2023-09-02 07:10:47 -07:00
Daniel Imms 91456fff04 More proxy impl 2023-09-02 06:06:51 -07:00
Daniel Imms 13af55f9fc Add onWriteParsed event to proxy 2023-09-02 06:00:33 -07:00
Daniel Imms 66454d378b Add todos 2023-09-01 08:50:39 -07:00
Daniel Imms 92d09f2ea1 Clean up, fix errors, add todo 2023-09-01 08:50:03 -07:00
Daniel Imms fac5e5f02d Improve types of proxy object to extend base interfaces 2023-09-01 08:46:14 -07:00
Daniel Imms 4ed97cae3a Merge branch 'master' into playwright 2023-09-01 07:46:35 -07:00
Daniel Imms ceef536b79 Upgrade es6 -> es2021
This uses the recommended target for node 16 in tsconfig/bases.

Fixes #4706
2023-09-01 07:36:48 -07:00
YAYA 刘玉婷 7fa56fde0b Merge branch 'master' into underline-dotted 2023-09-01 14:12:01 +08:00
Daniel Imms 7bd9f8ee38 Revert image addon options type name 2023-08-28 02:52:03 -07:00
Daniel Imms 2dd4dfda80 Merge pull request #4729 from tisilent/circle-line-custom-powerline-glyph
Update circle line custom powerline glyph.
2023-08-28 02:28:41 -07:00
Daniel Imms f7ac0d878b Center new semi-circle line glyphs 2023-08-28 02:20:31 -07:00
Daniel Imms fe2723b585 Merge branch 'master' into circle-line-custom-powerline-glyph 2023-08-28 02:13:56 -07:00
tisilent 7fecec6599 Offset outward 2023-08-28 16:54:27 +08:00
Per Bothner 44e19775f5 Merge branch 'master' into clusters 2023-08-27 11:58:57 -07:00
Daniel Imms 5b25c65521 Migrate Parser tests to playwright/test 2023-08-27 09:11:47 -07:00
Daniel Imms cb977ab6b6 Remove CharWidth.test.ts from api (in playwright) 2023-08-27 09:03:55 -07:00
Daniel Imms 2b21f27ac2 Fix demo build script 2023-08-27 09:00:48 -07:00
Daniel Imms ec984d25db Install --with-deps 2023-08-27 08:56:40 -07:00
Daniel Imms 7000447915 Build demo step 2023-08-27 08:54:04 -07:00
Daniel Imms 486d61736b Start demo 2023-08-27 08:50:24 -07:00
Daniel Imms a4683ab874 dist -> /dist 2023-08-27 08:44:24 -07:00
Daniel Imms b26c53d7e2 Make client dist a build artifact 2023-08-27 08:28:23 -07:00
Daniel Imms 86b8744838 Install playwright deps 2023-08-27 08:22:54 -07:00
Daniel Imms 6f04e00ea1 Add test-playwright-parallel job 2023-08-27 08:16:53 -07:00
Daniel Imms 9eadaf7079 Feature detect WebAssembly instead 2023-08-27 08:10:58 -07:00
Daniel Imms fbebabe2e6 Add @playwright/test support 2023-08-27 08:08:52 -07:00
Daniel Imms 48184cc94f Merge pull request #4734 from xtermjs/coverage
Bring back unit test coverage report
2023-08-27 07:49:05 -07:00
Daniel Imms 923c28cb77 Use node 18 in coverage 2023-08-27 07:43:11 -07:00
Daniel Imms 03c1906f13 Have coverage depend on build 2023-08-27 07:33:46 -07:00
Daniel Imms 2b7b4d6fea Upgrade playwright 2023-08-27 07:31:20 -07:00
Daniel Imms abae7b6210 Merge pull request #4733 from Tyriar/mutable
Adopt MutableDisposable for most usages of pattern `<var>?.dispose(); <var> = undefined`
2023-08-27 07:29:02 -07:00
Daniel Imms 12a862c277 Bring back unit test coverage report 2023-08-27 07:28:04 -07:00
Daniel Imms 38c6af9b46 Fix _renderer access in api test 2023-08-27 07:22:08 -07:00
Daniel Imms 2eaa9b3b69 Fix remaining issues with MutableDisposable usage 2023-08-27 07:15:51 -07:00
Daniel Imms 37b0e4018c More adoption of MutableDisposable 2023-08-27 07:03:27 -07:00
Daniel Imms 57db72d287 More adoption of MutableDisposable 2023-08-27 06:55:16 -07:00
Daniel Imms ec02bab97c Use MutableDisposable in CursorRenderLayer 2023-08-27 06:46:49 -07:00
Daniel Imms 94ed3e800a Don't dispose of texture atlas in canvas addon
This would cause problems if the atlas is shared between multiple
terminals.
2023-08-27 06:44:48 -07:00
Daniel Imms 1e1ccba238 Use MutableDisposable in BaseRenderLayer 2023-08-27 06:44:11 -07:00
Daniel Imms a0d0c923f3 Merge pull request #4732 from Tyriar/texture_utilization
Improve texture atlas utilization and fix glyph corruption when merging
2023-08-26 15:46:52 -07:00
Daniel Imms aba16687b0 Fix high pressure texture atlas corruption
The corruption was caused by confusion with page indexes when
merging pages. The fix is to simplify it by deleting all pages
and then just adding the new page.

Fixes #4534
Fixes #4351
2023-08-26 10:23:09 -07:00
Daniel Imms 797a71695f Improve texture atlas utilization
- Changed the threshold at which pages start to merge from MAX/2 to
  MAX.
- If a glyph is about to create a new page that will be merged,
  check if the existing row fits when ignoring the row pixel
  threshold. This will improve texture utilization by using the
  available space before the page is merged and becomes static.
2023-08-26 09:37:08 -07:00
Daniel Imms 55c5a8560c Merge pull request #4727 from jerch/fix_4720
remove inwasm burden
2023-08-25 07:50:45 -07:00
tisilent 9e768a4c7c Update circle line custom powerline glyph. 2023-08-25 18:37:48 +08:00
tisilent 42d6c2bd6b Use hex 2023-08-25 14:37:03 +08:00
tisilent 810e62665f Clean 2023-08-25 14:30:34 +08:00
tisilent bec1642123 Modify variantOffset calculation logic 2023-08-25 14:17:36 +08:00
xie jialong 努力鸭andDaniel Imms 08f7b4c53c Update src/browser/renderer/shared/CellColorResolver.ts
Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
2023-08-25 10:34:31 +08:00
xie jialong 努力鸭andDaniel Imms d15abd7f28 Update src/browser/renderer/shared/CellColorResolver.ts
Co-authored-by: Daniel Imms <2193314+Tyriar@users.noreply.github.com>
2023-08-25 10:33:22 +08:00
jerch d367eb41d2 Merge branch 'master' into fix_4720 2023-08-24 17:32:08 +02:00
Jörg Breitbart 7c164efdcc fix CI scripts 2023-08-24 17:30:52 +02:00
Jörg Breitbart bd76cdbd20 resort wasm to xterm-wasm-parts 2023-08-24 17:24:25 +02:00
Per Bothner dc6dd6d2a8 Remove precedingCodepoint - use precedingJoinState instead
repeatPrecedingCharacter (for REP sequence) changed to look at
the grapheme cluser to the "left" in the BufferLine, and repeat that.
This is an extension of the xterm behavior, and changes the
semantics of REP, so is not fully compatible.
However, the new behavior is cleaner and saner.

Moved precedingJoinState property to EscapeSequenceParser.
2023-08-24 07:58:06 -07:00
Daniel Imms 40e51aba6b Merge pull request #4726 from Tyriar/no_confusing
Warn on eslint rule @typescript-eslint/no-confusing-void-expression
2023-08-24 06:41:18 -07:00
Daniel Imms f9dc26d413 Merge branch 'master' into no_confusing 2023-08-24 06:33:43 -07:00
Daniel Imms 2fe082beea Warn on eslint rule @typescript-eslint/no-confusing-void-expression 2023-08-24 06:33:11 -07:00
Daniel Imms 2835976b81 Merge pull request #4725 from Tyriar/no_useless_ctor
Warn on eslint rule @typescript-eslint/no-useless-constructor
2023-08-24 06:30:59 -07:00
Daniel Imms 1968e8ced4 Merge branch 'master' into no_useless_ctor 2023-08-24 06:24:54 -07:00
Daniel Imms 1965daff50 Warn on eslint rule @typescript-eslint/no-useless-constructor 2023-08-24 06:24:25 -07:00
Daniel Imms f4881872f7 Remove unused private prop 2023-08-24 06:12:56 -07:00
Daniel Imms f1f0191d98 Merge branch 'master' into underline-dotted 2023-08-24 06:02:48 -07:00
tisilent 6ace416224 Add license header 2023-08-24 15:55:24 +08:00
tisilent 52c87bc8b3 Add tests for computeVarinatOffset 2023-08-24 14:46:30 +08:00
tisilent edfacbb5c6 Adjusting the execution process 2023-08-24 11:54:18 +08:00
tisilent 564371eae7 Clean unused member 2023-08-24 11:38:51 +08:00
tisilent e09ed98cf1 Merge branch 'underline-dotted' of https://github.com/tisilent/xterm.js into underline-dotted 2023-08-24 11:05:05 +08:00
tisilent 2b0106f7e2 Logic move to CellColorResolver 2023-08-24 10:57:05 +08:00
Daniel Imms 0e3db591c0 Merge pull request #4724 from Tyriar/webpack_eslint
@ts-check webpack files, fix vscode language of eslint file
2023-08-23 16:50:23 -07:00
Daniel Imms 224902af9f Merge branch 'master' into webpack_eslint 2023-08-23 16:37:37 -07:00
Daniel Imms 131f578367 Merge pull request #4723 from Tyriar/demo_tscheck
Use ts-check in server and start
2023-08-23 16:37:29 -07:00
Daniel Imms 6b794285c6 Remove esbuild
Accidentally added
2023-08-23 16:32:22 -07:00
Daniel Imms e78f85bf65 ts-check webpack configs 2023-08-23 16:29:45 -07:00
Daniel Imms 9be0b6d918 Force eslintrc to use jsonc language 2023-08-23 16:29:38 -07:00
Daniel Imms 3aa31111de Merge branch 'master' into demo_tscheck 2023-08-23 16:26:07 -07:00
Daniel Imms 81baad6acd Prefer const 2023-08-23 16:26:00 -07:00
Daniel Imms 25ef47a78f Use express-ws types 2023-08-23 16:25:15 -07:00
Daniel Imms 7d7d593fee Merge pull request #4722 from Tyriar/client_warnings
Fix demo client.ts warnings
2023-08-23 16:22:28 -07:00
Daniel Imms 766ffde4ca Merge pull request #4721 from Tyriar/complex_options
Fix demo warnings by adding complex options
2023-08-23 16:22:20 -07:00
Daniel Imms 4534b56c1f Use ts-check in server and start 2023-08-23 16:20:55 -07:00
Daniel Imms ee0da5e4c1 Fix demo client.ts warnings 2023-08-23 16:03:25 -07:00
Daniel Imms e5d60c0895 Fix demo warnings by adding complex options 2023-08-23 16:00:16 -07:00
Daniel Imms 5ccf4d3311 Merge remote-tracking branch 'upstream/master' into pr/PerBothner/4519-1 2023-08-23 05:09:42 -07:00
Daniel Imms 1f3143cfab Remove unused member 2023-08-23 05:07:44 -07:00
Daniel Imms f5d128b0d5 Merge remote-tracking branch 'upstream/master' into pr/tisilent/4703 2023-08-23 05:02:07 -07:00
Daniel Imms 2268ae3967 Merge pull request #4718 from Tyriar/no_unused
Add no unused variables lint warning
2023-08-23 04:57:55 -07:00
Daniel Imms 921da1a2ea Ignore no-unused-vars in .api, organize all remaining imports 2023-08-23 04:47:53 -07:00
Daniel Imms ebd4092bee Ignore no-unused-vars in args 2023-08-23 04:42:44 -07:00
Daniel Imms b6fd7a2b93 Ignore no-unused-vars in test files 2023-08-23 04:42:21 -07:00
Daniel Imms 210ba8109c Add no unused variables lint warning
This shows a warning while compiling, so demo bundling will still happen but
it will be rejected when a PR is made.
2023-08-23 04:34:55 -07:00
tisilent 25afc19895 Merge branch 'underline-dotted' of https://github.com/tisilent/xterm.js into underline-dotted 2023-08-23 09:33:20 +08:00
Daniel Imms 68ded1a5b4 Merge branch 'master' into underline-dotted 2023-08-22 07:47:42 -07:00
Daniel Imms 317ccdac66 Merge pull request #4716 from xtermjs/Tyriar-patch-1
Fix typo in ci.yml
2023-08-22 07:33:02 -07:00
Daniel Imms 43a3251bee Fix typo in ci.yml 2023-08-22 07:32:51 -07:00
Daniel Imms 94ab56542f Merge pull request #4715 from Tyriar/waiton
Parallelize required tests and build jobs
2023-08-22 07:31:25 -07:00
Daniel Imms 92f1881dfe Polish job names
This matches the npm script names closer
2023-08-22 07:21:27 -07:00
Daniel Imms ec4c018f73 Remove windows from fast 2023-08-22 07:15:02 -07:00
Daniel Imms 2c25dd1970 Fix invalid names 2023-08-22 07:14:11 -07:00
Daniel Imms 06fbe69b09 Split out integration tests too 2023-08-22 07:05:55 -07:00
Daniel Imms 4bd154e7dc Split fast and slow unit tests to free agents 2023-08-22 07:04:12 -07:00
Daniel Imms 516756fad8 Fix install step 2023-08-22 07:01:27 -07:00
Daniel Imms 2b3cfb39a1 Merge branch 'master' into waiton 2023-08-22 06:58:01 -07:00
Daniel Imms e9cbb3e547 Add job name 2023-08-22 06:57:20 -07:00
Daniel Imms 1744801867 Try parallelize tests and build 2023-08-22 06:52:57 -07:00
Daniel Imms 64cb9a3c62 Merge pull request #4714 from Tyriar/4713
Don't smooth scroll when it's a no-op
2023-08-22 06:49:52 -07:00
Daniel Imms 0e947788e0 Don't smooth scroll when it's a no-op
Fixes #4713
2023-08-22 06:39:59 -07:00
Daniel Imms 60b59db94f Merge pull request #4709 from Tyriar/tyriar/logger
Fix error that can occur when loading canvas addon
2023-08-22 06:27:06 -07:00
Daniel Imms 6d7032a906 Merge pull request #4710 from Tyriar/4704
Move addon install to presetup
2023-08-22 06:23:10 -07:00
Daniel Imms b452fc9e85 Merge pull request #4712 from Tyriar/timeout
Put reasonable GH action timeouts in place
2023-08-22 06:22:55 -07:00
Daniel Imms dac4dec0ad Put reasonable GH action timeouts in place
Fixes #4711
2023-08-22 06:13:52 -07:00
Daniel Imms eae79e93f3 Install addons in CI 2023-08-22 06:11:54 -07:00
Daniel Imms ee33765932 Move addon install to presetup
Fixes #4704
2023-08-22 06:04:33 -07:00
Daniel Imms 8af83fef85 Fix error that can occur when loading canvas addon 2023-08-22 06:00:44 -07:00
tisilent 5f0647f0ab clean 2023-08-22 09:35:12 +08:00
tisilent fe7f17f422 clean 2023-08-22 09:26:01 +08:00
Per Bothner e5a2ebda0e Provide with "15" and "15-graphemes" UnicodeProviders
Th former doesn't support grapheme clusters, except the old-fashioned
kind of simple modifiers.  However, "15-graphemes" (with full
cluster support) is the default.
2023-08-21 13:03:06 -07:00
Per Bothner 2204375788 Merge branch 'master' into clusters 2023-08-21 07:59:15 -07:00
tisilent c81dfee43c Using ext to store variants. 2023-08-21 20:54:16 +08:00
tisilent cb175e513d Variants to Canvas. 2023-08-21 19:45:38 +08:00
tisilent 32da1d81d5 Use variants for underline dotted.
webgl
2023-08-21 19:09:02 +08:00
Daniel Imms 6f0a5c9f0c Merge pull request #4695 from PerBothner/demo
demo: auto-resize and other tweaks
2023-08-20 09:31:06 -07:00
Daniel Imms 1529e0bf04 Remove unused variable 2023-08-20 07:33:15 -07:00
Daniel Imms 6021e6cf81 Merge branch 'master' into demo 2023-08-20 07:29:31 -07:00
Daniel Imms 427d33c7b7 Merge pull request #4700 from Tyriar/ci_concise
Make GH actions strategy more concise
2023-08-19 15:41:37 -07:00
Daniel Imms 95f332cb13 Merge pull request #4699 from Tyriar/slow_tests
Improve slow tests
2023-08-19 15:34:08 -07:00
Daniel Imms db4567599b Make GH actions strategy more concise 2023-08-19 15:28:44 -07:00
Daniel Imms 0667c7aedd Merge pull request #4698 from Tyriar/codeql
Revert codeql file name change
2023-08-19 15:22:46 -07:00
Daniel Imms 1c5596de66 Split up Base64Decoder decoding tests
Fixes #4696
2023-08-19 15:21:42 -07:00
Daniel Imms 905707284d Up parser unti test timeout 10s -> 30s 2023-08-19 15:18:44 -07:00
Daniel Imms 67f46a54b8 Split up StringToUtf32 decoder tests
Part of #4696
2023-08-19 15:17:11 -07:00
Daniel Imms b8db3853f1 Merge pull request #4697 from xtermjs/Tyriar-patch-1
Remove Azure Pipelines badge
2023-08-19 15:07:15 -07:00
Daniel Imms a9015c0ee6 Revert codeql file name change 2023-08-19 15:05:32 -07:00
Daniel Imms 60db1e7f82 Remove Azure Pipelines badge 2023-08-19 14:57:25 -07:00
Daniel Imms 6dae811dae Migrate to GitHub Actions
Fixes #3297
2023-08-19 14:47:35 -07:00
Per Bothner a20599efb4 Merge branch 'master' into demo 2023-08-19 09:15:30 -07:00
jerch 27b8d73f66 Merge pull request #4694 from jerch/fix_bce_demo
fix spaces in bce demo
2023-08-19 17:43:36 +02:00
Per Bothner 025e8505d5 implement autoResize for terminal in demo
This is optional (but the default): You can still explicitly set COLSxROWS,
but "auto" uses a ResizeObserver sets the size based on window size.
2023-08-19 08:28:43 -07:00
Jörg Breitbart 16f5900252 fix spaces in demo 2023-08-19 17:28:27 +02:00
Per Bothner e2d699cb32 Styling tweaks for demo
* Make terminal take 2/3 of the width, and the options etc get 1/3
* Remove options height limit, which could lead to annoying nested
  verical scroll regions.  (An inner region for the options inside a
  scrollable viewport.)
2023-08-19 08:23:31 -07:00
Daniel Imms 156f75628a Merge pull request #4692 from Tyriar/2117
Stub out all CSI api tests
2023-08-19 06:25:57 -07:00
Daniel Imms 8fad65d1d5 Stub out all CSI tests
Part of #2117
2023-08-19 06:11:29 -07:00
Daniel Imms 0867804504 Prefer arrow function 2023-08-19 05:33:49 -07:00
Daniel Imms f0900fdc5f Tweak format of CSI test names to make it easier to see terminating char 2023-08-19 05:32:41 -07:00
Daniel Imms 0be744b567 Merge pull request #4691 from Tyriar/4690
Improve lifecycle of WebLinksAddon.api, test all country tlds
2023-08-19 05:22:14 -07:00
Daniel Imms 243b0bb626 Add all country tlds to tests 2023-08-19 05:07:41 -07:00
Daniel Imms 0b32b42134 Improve lifecycle of WebLinksAddon.api
Part of #4690
2023-08-19 05:00:45 -07:00
Daniel Imms ef1cd4318b Merge pull request #4688 from Tyriar/cursor_style
Simplify cursor style types in webgl
2023-08-19 04:51:15 -07:00
Per Bothner 6e39d03a52 Some html/css cleanps in demo
* id="grid" should be id="class" (since "grid" is not unique in the document).
* Remove space after 'id=' (multiple places).
* Group 3 texture-atlas elements in new <div class="texture-atlas-container">.
2023-08-18 16:30:36 -07:00
Daniel Imms e21e52569c Merge branch 'master' into clusters 2023-08-18 15:20:02 -07:00
Daniel Imms 7b7dbd36d6 Merge pull request #4689 from Tyriar/4685
Track CursorBlinkStateManager in MutableDisposable
2023-08-18 14:38:05 -07:00
Daniel Imms d03b5c9481 Track CursorBlinkStateManager in MutableDisposable
Fixes #4685
2023-08-18 14:26:56 -07:00
Daniel Imms 93e060aeb2 Add MutableDisposable tests 2023-08-18 14:24:50 -07:00
Per Bothner 00fd2b8503 Set unicode.activeVersion when loading UnicodeGraphemeProvider. 2023-08-18 14:17:39 -07:00
Daniel Imms a84351ad0c Add MutableDisposable
Part of #4685
2023-08-18 14:15:56 -07:00
Daniel Imms 25a78c77f2 Simplify cursor style types in webgl
Fixes #4686
2023-08-18 14:11:17 -07:00
Daniel Imms a35fa611ff Merge pull request #4687 from Tyriar/tracing
Add trace log level, @traceCall decorator and use in webgl
2023-08-18 11:14:52 -07:00
Daniel Imms 0b54c9a5d6 Add trace log level, traceCall decorator and use in webgl
- New 'trace' log level in the API, you should expect very spammy logs when
  trace is on and filter them down. As opposed to 'debug' which should be more
  readable.
- traceCall decorator logs the args and return value of the decorated method.
  Wecan use this on key functions in various parts of the code to assist
  debugging issues that are hard to reproduce such as #4665.
- Decorated a few webgl render methods for #4665.
- There's an early exit in traceCall when not on the trace log level so the
  runtime impact when not in trace is negligable.

Part of #4665
2023-08-18 11:04:23 -07:00
Per Bothner 21fd545381 Don't load unicode11 addon on demo startup. 2023-08-18 08:46:33 -07:00
Per Bothner 6c1eb97a18 Remove no-longer-applicable comment. 2023-08-17 14:53:23 -07:00
Per Bothner 2070cc45d4 Merge branch 'master' into clusters 2023-08-17 13:29:22 -07:00
Per Bothner f1bc95622d Add more grapheme-cluster examples to test and demo 2023-08-17 13:23:10 -07:00
Daniel Imms 3b3b23a2fd Merge pull request #4683 from Tyriar/tyriar/minor_cleanup
Remove unneeded comments, headless options
2023-08-17 09:25:31 -07:00
Per Bothner e3d3cdb9d2 Merge branch 'master' into clusters 2023-08-17 09:17:14 -07:00
Daniel Imms 7b874473d3 Remove unneeded comments, headless options 2023-08-17 09:10:38 -07:00
Daniel Imms 9d7b9293eb Merge pull request #4681 from PerBothner/dom-selection
Fix bug in selection handling in dom renderer
2023-08-17 09:01:12 -07:00
Per Bothner 957e3e0f08 Fix bug in selection handling in dom renderer 2023-08-16 15:34:35 -07:00
Per Bothner 5994e25841 Merge branch 'master' into clusters 2023-08-15 09:20:47 -07:00
Daniel Imms 2f0a7eee8d Merge pull request #4679 from Tyriar/4663
Reduce repetition with internal terminal types and inherit docs from API
2023-08-15 08:49:40 -07:00
Daniel Imms 1a3e14a24c Merge pull request #4680 from Tyriar/crash
Revert Stylesheet change
2023-08-15 08:49:05 -07:00
Daniel Imms a6b67fb8a6 Remove unused headless types file 2023-08-15 08:39:20 -07:00
Daniel Imms 843bdc4d55 Revert "Merge pull request #4611 from SimonSiefke/constructed-stylesheets"
This reverts commit 5889344dd2, reversing
changes made to 679c149164.
2023-08-15 08:33:42 -07:00
Daniel Imms 2aee19f0e1 Revert "Workaround crash that can happen in Electron/Chromium"
This reverts commit 2ca0ccbe0c.
2023-08-15 08:31:34 -07:00
Daniel Imms 9f3be5e28d Simplify terminal interfaces
Fixes #4663
2023-08-15 07:49:31 -07:00
Daniel Imms f69f803f0f Implement public APIs internally to inherit docs
Part of #4663
2023-08-15 07:46:51 -07:00
Daniel Imms 2eca26b210 Merge pull request #4678 from Tyriar/vscode189753
Workaround crash that can happen in Electron/Chromium
2023-08-15 07:01:28 -07:00
Daniel Imms 2ca0ccbe0c Workaround crash that can happen in Electron/Chromium
Part of microsoft/vscode#189753
2023-08-15 06:46:35 -07:00
Per Bothner cf243adfe3 Merge branch 'master' into clusters 2023-08-14 12:22:55 -07:00
Daniel Imms c908eeed5c Merge pull request #4667 from Dennnnny/fix-transparent-foreground-color
Fix transparent foreground color
2023-08-14 12:11:04 -07:00
Daniel Imms caa1223e5c Merge pull request #4677 from Tyriar/fix_headless
Fix headless types regression
2023-08-14 07:18:50 -07:00
Daniel Imms 62cf3d39e1 Fix headless types regression
From the API lint PR
2023-08-14 07:15:20 -07:00
Daniel Imms 2437b68d5d Merge pull request #4676 from Tyriar/4097_2
Remove redundant condition
2023-08-14 06:01:07 -07:00
Daniel Imms 09fc798e80 Remove redundant condition
Part of #4097
2023-08-14 05:47:25 -07:00
Daniel Imms 7ae6febedc Merge pull request #4673 from Tyriar/4097
DOM: Render selection color instead of cell bg
2023-08-14 05:34:14 -07:00
Daniel Imms 39ae0f45fd Fix selectionForeground dom tests 2023-08-14 04:43:55 -07:00
dennnnny 855e911398 Fix transparent foreground color 2023-08-14 09:49:18 +08:00
Daniel Imms 73a77cda3d DOM: Render selection color instead of cell bg
Summary:

- Selection cell reuse has been added to the DOM renderer
- Selection bg override is now correctly set correctly
- Selection elements 'pretend' to be a decoration in order to render bg

Fixes #4097
2023-08-13 13:56:51 -07:00
Daniel Imms 6c9346011d Merge pull request #4672 from Tyriar/4262
Enforce half minimum contrast ratio for dim text
2023-08-13 13:14:45 -07:00
Daniel Imms 28c4732abc Fix ThemeService.ctor test 2023-08-13 13:04:40 -07:00
Daniel Imms 1cef30cca0 Enforce half minimum contrast ratio for dim text
Provided MCR is not too high, this ensures dim text differs from normal
text and has a reasonable difference in contrast.

Fixes #4262
2023-08-13 11:27:57 -07:00
Daniel Imms af787e1c85 Merge pull request #4671 from Tyriar/4652
Fix SortedList.values iteration and general dec lifecycle fixes
2023-08-13 10:53:20 -07:00
Daniel Imms 70f6fa2bc9 Fix SortedList.values iteration and general dec lifecycle fixes
Fixes #4652
2023-08-13 10:42:45 -07:00
dennnnny bef87403db Fix force transparent foreground colors to be opaque 2023-08-13 17:52:49 +08:00
Daniel Imms 5890029f71 Merge pull request #4669 from Tyriar/api_lint
Lint API .d.ts files
2023-08-12 10:32:53 -07:00
Daniel Imms 1f4fe0a8c0 Lint API .d.ts files
Similar to #4668, this brings linting to the API files with a cut down
set of rules. One of the bigger ones is comment length is restricted to 80,
this was done as opposed to 100 for regular code to reduce the chance of
wrapping or API going off screen regardless of resolution or window/browser
size
2023-08-12 09:33:35 -07:00
Daniel Imms 519f6a3d4a Merge pull request #4668 from Tyriar/comment_lint
Restrict comments to 100 characters
2023-08-12 09:18:14 -07:00
Daniel Imms 530f758905 Restrict comments to 100 characters
This is a rule I try enforce in PR but it's a bit of a hassle, this will
give a lint warning when it happens resulting in:

- Yellow underline in supported editors when eslint is installed
- Compilation will succeed since it's a warning not an error
- CI will fail as it does not allow lint warnings

Special case comments are ignored which includes @vt comments, table
comments and commented out code.
2023-08-12 09:04:41 -07:00
dennnnny fb7349bc87 Fix transparent foreground color 2023-08-12 08:39:39 +08:00
Daniel Imms dc390ab03a Merge pull request #4657 from tisilent/add-cursorInactiveStyle-option
Add cursorInactiveStyle option
2023-08-11 13:16:51 -07:00
Daniel Imms 6f6cc6a686 Remove string mapping, improve types, standardize on 'outline' 2023-08-11 13:09:31 -07:00
Daniel Imms 136e2f2afe Improve API wording 2023-08-11 13:07:04 -07:00
Daniel Imms 73bb72dbcf Merge pull request #4666 from Tyriar/nvm
Add nvmrc using node 16
2023-08-11 10:03:41 -07:00
Daniel Imms 4b2f774f53 Merge pull request #4664 from tisilent/fix-canvas-underline-cutoff
Fix canvas underline is cut off.
2023-08-11 10:01:28 -07:00
Daniel Imms 0a4151fbfa Add nvmrc using node 16
node-pty doesn't seem to work 18 yet and VS Code has moved over to be based
on 18 so that's my main (don't ask me why it's working there but not in this
repo)
2023-08-11 09:52:15 -07:00
Daniel Imms 07d187151e Update src/browser/renderer/shared/TextureAtlas.ts 2023-08-11 09:50:22 -07:00
Daniel Imms 47f606f0df Merge pull request #4662 from Tyriar/inwasm
Add functional yarn wasm
2023-08-11 05:09:25 -07:00
Daniel Imms 18125dad84 Add functional yarn wasm
This is what I tried after seeing the error so it will improve the #4646
experience until a real fix is in place

Part of #4646
2023-08-11 04:58:07 -07:00
tisilent f317b96262 Fix canvas underline is cut off. 2023-08-11 17:58:29 +08:00
tisilent c3d8c2a919 Update test and fix 2023-08-11 15:47:50 +08:00
tisilent 5c1e6dce99 Add block to cursorInactiveStyle,
change line to bar
2023-08-11 11:36:40 +08:00
tisilent 0321bcb715 Remove special classes.
Add xterm-cursor-outline class.
2023-08-11 09:40:06 +08:00
Per Bothner aac5d4704e Merge branch 'master' into clusters 2023-08-10 12:24:51 -07:00
Per Bothner fb2c6801d4 Replace comments by assert message in unicode-graphemes tests
Also use plain equal instead of deepEqual (overkill).
2023-08-10 11:39:47 -07:00
Daniel Imms bb5d61fb14 Merge pull request #4659 from SvanT/dispose-blink-state-manager
Dispose blink state manager
2023-08-10 10:27:24 -07:00
Svante Boberg 3b3012353f Use disposable registration 2023-08-10 19:04:20 +02:00
Svante Boberg adad53d526 Dispose blink state manager 2023-08-10 18:47:04 +02:00
jerch 9b21786062 Merge branch 'master' into clusters 2023-08-10 18:31:04 +02:00
Daniel Imms 1b4460e37d Merge pull request #4655 from Tyriar/tyriar/4645
Fix API facade memory leaks
2023-08-10 07:29:14 -07:00
tisilent 482dad3036 Add cursorInactiveStyle option 2023-08-10 16:11:04 +08:00
Daniel Imms 7276027861 Merge pull request #4651 from jerch/fix_4642
fix decorations on DOM renderer
2023-08-09 16:08:23 -07:00
Daniel Imms 62055522fb Fix API facade memory leaks
We need to register/dispose any event created in the facades, otherwise
embedders need to dispose of the listeners manually.

Fixes #4645
2023-08-09 15:55:31 -07:00
jerch 0366aa2217 Merge branch 'master' into fix_4642 2023-08-10 00:24:03 +02:00
Jörg Breitbart 2b79b7b29f faster SortedList._search 2023-08-10 00:12:00 +02:00
Per Bothner 3bfe5d86c0 Add testOptions parameter to openTerminal in TestUtils.
This is used to control whether the UnicodeGraphemesAddon is loaded.
2023-08-09 14:44:45 -07:00
Daniel Imms 02243173c2 Merge pull request #4648 from tisilent/fix-double-underline
fix double underline, upwards
2023-08-09 06:45:03 -07:00
Jörg Breitbart a84a95055d exclude decorated cells from merging 2023-08-09 14:20:08 +02:00
tisilent b8bf35be17 Add restrictToCellHeight,Restore abnormal format 2023-08-09 11:53:30 +08:00
Per Bothner b9a4760b44 Move files imported from unicode-properties into subdirectory
Specifically  addons/xterm-addon-unicode-graphemes/src/third-party/.
2023-08-08 18:32:37 -07:00
tisilent 3ba579f680 fix double underline, upwards 2023-08-08 18:36:44 +08:00
Per Bothner 302da18c81 Rename local variable precedingInfo in InputHandler to precedingJoinState 2023-08-07 13:08:35 -07:00
Per Bothner 4fbc623706 Expand doc comments for UnicodeCharProperties and UnicodeCharWidth. 2023-08-07 11:55:52 -07:00
Per Bothner b9abbc0a85 Split complicated conditional expression. 2023-08-07 11:10:06 -07:00
Per Bothner f1035405e6 Move precedingJoinState from EscapeSequenceParser to InputHandler
This allows InputHandler._parser to be IEscapeSequenceParser
rather than EscapeSequenceParser.
2023-08-06 12:44:43 -07:00
Per Bothner 720297946b Changed xterm-addon-unicode-graphemes version number to 0.1.0. 2023-08-06 11:53:11 -07:00
Per Bothner 988b3b1ab2 Remove tailing space. 2023-08-06 11:52:39 -07:00
Per Bothner 88bfc6bb2b Tweak charProperties doc comment. 2023-08-06 08:28:08 -07:00
Per Bothner a0dc88165f Fix copyright year in new file. 2023-08-06 08:20:52 -07:00
Per Bothner dccfc11b4f Tweak to avoid line-ending spaces.
Line-ending spaces were unintentionally removed - this avoids the problem,
2023-08-06 08:19:14 -07:00
Per Bothner 42042155d4 Merge branch 'master' into clusters 2023-08-03 22:30:46 -07:00
Per Bothner 6b2459317b Null out following columns after grapheme cluster 2023-08-03 22:29:36 -07:00
Daniel Imms 08a0914a78 Add grapheme cluster test button to demo 2023-08-02 11:59:30 -07:00
Daniel Imms 4f41070b45 Merge pull request #4638 from Tyriar/4603
Fix reset and clear leaving viewport in a bad state
2023-08-02 11:55:14 -07:00
Daniel Imms d2031955ec Remove error from MockViewport.reset 2023-08-02 11:42:40 -07:00
Daniel Imms 7baff4e249 Merge branch 'master' into clusters 2023-08-02 11:41:22 -07:00
Daniel Imms 91c08ed48e Fix clear leaving viewport in a bad state
Fixes #4603
2023-08-02 11:30:43 -07:00
Daniel Imms acf53f69e0 Ensure viewport is correctly reset on term.reset
Part of #4603
2023-08-02 11:18:00 -07:00
Daniel Imms bb237f109a Merge pull request #4637 from meganrogge/merogge/fix-acc-tree
fix a11y tree
2023-08-02 08:30:06 -07:00
meganrogge 44d4ec83fc revert change 2023-08-02 08:17:18 -07:00
meganrogge 33124a31bd fix #4571 2023-08-02 08:14:16 -07:00
Daniel Imms 1e90aab2a6 Merge pull request #4636 from Tyriar/4588
Add ignoreBracketedPasteMode option
2023-08-01 14:40:39 -07:00
Daniel Imms 44ced27bee Add ignoreBracketedPasteMode option
Fixes #4588
2023-08-01 13:58:52 -07:00
Daniel Imms c3def09c38 Merge pull request #4631 from jerch/missing_image_changes
image addon fixes
2023-08-01 12:38:59 -07:00
Daniel Imms afff339d28 Merge pull request #4605 from jerch/faster_dom
Faster DOM renderer
2023-08-01 12:32:56 -07:00
Jörg Breitbart b7a597f925 use offsetWidth for measuring 2023-08-01 19:53:41 +02:00
Jörg Breitbart ae84ee39f3 Merge branch 'master' into faster_dom 2023-08-01 19:21:30 +02:00
jerch 73e60586c9 Merge pull request #4584 from dlech/fix-underline-style
use border-bottom instead of box-shadow for underline cursor in DOM renderer
2023-08-01 19:15:41 +02:00
Jörg Breitbart b56bc77dcc make font variant positions explicit with const enum 2023-08-01 18:35:48 +02:00
Jörg Breitbart 32a852c0bf remove private binding of document in width cache ctor 2023-08-01 18:30:06 +02:00
Jörg Breitbart 40e622dfc8 change comment format 2023-08-01 18:29:00 +02:00
Jörg Breitbart 994861a6fa change repeat variable to const enum 2023-08-01 18:25:29 +02:00
Jörg Breitbart b770431102 Merge branch 'master' into faster_dom 2023-08-01 18:18:31 +02:00
Jörg Breitbart 2fd108c864 Merge branch 'missing_image_changes' of github.com:jerch/xterm.js into missing_image_changes 2023-08-01 18:12:50 +02:00
Jörg Breitbart 914f7be644 add image addon to publish 2023-08-01 18:11:03 +02:00
jerch 1fdb8c006d Merge branch 'master' into missing_image_changes 2023-08-01 17:42:34 +02:00
Daniel Imms b46404b139 Merge pull request #4568 from xzfc/webgl-cursor
Render the cursor in the WebGL canvas
2023-08-01 08:41:16 -07:00
Daniel Imms 1dfd14fbc0 Fix canvas count test 2023-08-01 08:28:59 -07:00
Jörg Breitbart a1ddc629dc make tests less data intensive 2023-08-01 17:26:02 +02:00
Daniel Imms 9cfc2c881c Merge pull request #4626 from Tyriar/tyriar/light_cursor
Fix demo light theme cursor colors
2023-08-01 08:08:29 -07:00
Jörg Breitbart b7f9db69ca update readme 2023-08-01 16:51:56 +02:00
Daniel Imms 60eb4f3385 Create ICursorRenderModel 2023-08-01 07:47:27 -07:00
Daniel Imms 41e97ec042 Always render cursor even if model didn't change
This ensures underline/bar cursors get rendered
2023-08-01 07:43:27 -07:00
Jörg Breitbart fe838726b0 transfer changes from 0.4.3 2023-08-01 16:43:14 +02:00
Daniel Imms 1cfce3d0b6 Fix demo light theme cursor colors 2023-08-01 06:37:00 -07:00
Daniel Imms f64cb1566d Correctly apply cursor colors in new renderer 2023-08-01 06:31:58 -07:00
Daniel Imms 9b204c012a Remove bad logs 2023-08-01 06:19:54 -07:00
Daniel Imms 6b33ac1e85 Share cursor blink state manager between canvas and webgl
This also focused the manager's creation on renderer start up, to ensure blink
works immediately.
2023-08-01 06:13:21 -07:00
Daniel Imms 18e578bd09 Merge branch 'master' into webgl-cursor 2023-08-01 05:53:45 -07:00
Daniel Imms e8a925b6af Merge pull request #4583 from jerch/fix_mouse_tracking
fix mouse tracking behavior
2023-08-01 05:50:20 -07:00
Daniel Imms db6e0cd2ef Merge pull request #4482 from tisilent/#4121
Add smoothScroll to scrollLines
2023-08-01 05:48:26 -07:00
Daniel Imms f6738ec354 Merge pull request #4577 from jerch/image_addon
move image addon to base repo
2023-08-01 05:40:48 -07:00
Daniel Imms 1067ec19a8 Implement smooth scroll for pages/top/bottom, add viewport request event 2023-08-01 05:31:30 -07:00
Daniel Imms e7a7842808 Use viewport source in tests 2023-08-01 05:11:19 -07:00
Daniel Imms ce3bb35c8c Merge pull request #4366 from arekouzounian/master
Fix for #2488. Use element offsetHeight rather than getBoundingRect
2023-08-01 05:05:42 -07:00
Daniel Imms 2d7b531bba Merge branch 'master' into #4121 2023-08-01 04:58:36 -07:00
Daniel Imms 2d81490ac4 Merge pull request #4387 from LabhanshAgrawal/ligatures-electron
Enable ligatures addon on electron
2023-08-01 04:57:16 -07:00
Daniel Imms 5939d72d8f Merge branch 'master' into master 2023-08-01 04:54:05 -07:00
Daniel Imms d1bd4973ad Merge pull request #4348 from silamon/ansiheadlessretry
SerializeAsHTML(): Fallback to default ansi colors when running headless terminal
2023-08-01 04:52:43 -07:00
Jörg Breitbart f407f0c5a6 unit tests 2023-07-31 21:24:39 +02:00
Jörg Breitbart 40eccfa61a Merge branch 'faster_dom' of github.com:jerch/xterm.js into faster_dom 2023-07-31 20:07:56 +02:00
Jörg Breitbart c79aa542c9 cache optimizations 2023-07-31 20:07:40 +02:00
jerch 366ffedf08 Merge branch 'master' into faster_dom 2023-07-31 18:01:16 +02:00
Jörg Breitbart c796514de8 apply weight settings in width cache 2023-07-31 16:49:58 +02:00
Jörg Breitbart e75ec5b51f revert changes to selection service 2023-07-31 16:09:44 +02:00
Jörg Breitbart 702c3578a3 re-add explicit span stylesheet 2023-07-30 19:03:54 +02:00
Jörg Breitbart 0eecf8187d Merge branch 'faster_dom' of github.com:jerch/xterm.js into faster_dom 2023-07-30 18:46:49 +02:00
Jörg Breitbart e9058b7498 implement default letter spacing 2023-07-30 18:46:33 +02:00
Daniel Imms 25b266e809 Merge pull request #4618 from Tyriar/4614_color_index
Add IntRange type for ColorIndex
2023-07-30 07:04:14 -07:00
Daniel Imms 2e638598e4 Simplify condition 2023-07-30 06:55:45 -07:00
jerch 8562635231 Merge branch 'master' into faster_dom 2023-07-30 13:37:45 +02:00
Jörg Breitbart b358754b46 respect dpr/charWidth changes, more accurate base measuring 2023-07-30 13:27:28 +02:00
Jörg Breitbart 64d04f0712 optimization: remove document fragment 2023-07-29 23:58:15 +02:00
Daniel Imms ebdafe54aa Merge pull request #4619 from Tyriar/tyriar/4611_2
Avoid using global document, add copyright
2023-07-29 14:50:50 -07:00
Daniel Imms 829ecac8e3 Merge branch 'master' into image_addon 2023-07-29 14:43:46 -07:00
Daniel Imms d22e3e093a Fix compile 2023-07-29 14:42:05 -07:00
Daniel Imms a9662e8b7b Avoid using global document, add copyright
Fixes #4611
2023-07-29 14:38:56 -07:00
Jörg Breitbart 5f98db9b76 re-enable failing test 2023-07-29 18:26:31 +02:00
Jörg Breitbart 664a110fd1 Merge branch 'master' into faster_dom 2023-07-29 18:07:47 +02:00
Jörg Breitbart 3b5044b55b readd doc notes on link underline handling 2023-07-29 17:54:14 +02:00
Jörg Breitbart e848151b50 change to width cache 2023-07-29 17:25:49 +02:00
Jörg Breitbart 91197bd1aa disable font kerning 2023-07-29 15:37:01 +02:00
Jörg Breitbart d1fdaa17d6 apply font variant, some cleanup 2023-07-29 14:16:47 +02:00
Daniel Imms 5660c404f0 Differentiate special color indexes and others 2023-07-28 16:32:05 -07:00
Daniel Imms 79c1fff853 Add IntRange type for ColorIndex
Fixes #4614
2023-07-28 13:51:46 -07:00
Daniel Imms 962c070a75 Merge branch 'master' into webgl-cursor 2023-07-28 13:42:47 -07:00
Jörg Breitbart 5bdd5022b2 some cleanup, use faster str join for classes 2023-07-28 19:33:38 +02:00
Jörg Breitbart 370bad1380 better caching:
- own cache class with flat and holey cache
- use letter spacing
- on-demand measuring
2023-07-28 18:36:01 +02:00
Daniel Imms 17b8247c3d Merge pull request #4617 from xtermjs/Tyriar-patch-1
Mention discussions in CONTRIBUTING.md
2023-07-28 07:44:13 -07:00
Daniel Imms c0d1dec847 Mention discussions in CONTRIBUTING.md 2023-07-28 07:33:35 -07:00
Daniel Imms 5889344dd2 Merge pull request #4611 from SimonSiefke/constructed-stylesheets
feature: use constructed style sheets for dom render so that it works with csp style-src 'self'
2023-07-27 12:45:31 -07:00
Simon Siefke 5f80fe00d5 fix: use replacesync instead of replace 2023-07-27 18:33:30 +02:00
Simon Siefke b225b9a710 fix eslint 2023-07-27 17:39:15 +02:00
Daniel Imms 72c51b19a5 Merge branch 'master' into constructed-stylesheets 2023-07-27 08:28:24 -07:00
Daniel Imms 679c149164 Merge pull request #4612 from SimonSiefke/update-typescript-version
update typescript version to 5.1.6
2023-07-27 08:28:09 -07:00
Simon Siefke 92a18defce remove one more public 2023-07-27 17:16:00 +02:00
Simon Siefke 859c9ec68d update typescript-eslint 2023-07-27 17:11:04 +02:00
Simon Siefke b4aeb1b3e7 fix eslint warnings 2023-07-27 13:29:02 +02:00
Simon Siefke 8f1313519f update typescript version to 5.1.6 2023-07-27 13:19:38 +02:00
Simon Siefke 1c0a25d01b feature: use constructed style sheets for dom render so that it works with csp style-src 'self' 2023-07-27 13:08:22 +02:00
Jörg Breitbart a5df5e7333 first unit tests 2023-07-27 11:25:57 +02:00
Jörg Breitbart 4bd3e1d0c2 remove magic numbers 2023-07-25 13:19:08 +02:00
Jörg Breitbart ad145541af exclude bold&italic variants from merge, limit glyph calc to latin + latin supplement 2023-07-25 12:47:35 +02:00
Jörg Breitbart 37153018b9 fix BCE 2023-07-24 16:06:19 +02:00
Jörg Breitbart 90f1318596 skip failing test for now 2023-07-24 00:01:51 +02:00
Jörg Breitbart 4a5ae78d35 try to fix search test error 2023-07-23 23:52:17 +02:00
Jörg Breitbart 097879b839 faster metrics calc 2023-07-23 23:36:25 +02:00
Jörg Breitbart 2d9ad32d93 fix weblinks api test 2023-07-23 22:25:58 +02:00
Jörg Breitbart 4d257f469b fix linter 2023-07-23 21:12:38 +02:00
Jörg Breitbart 521dc915dc fix weblink tests 2023-07-23 12:36:15 +02:00
Jörg Breitbart 5ea669f091 batch metrics calc 2023-07-23 00:08:40 +02:00
Jörg Breitbart aa6e8d91c2 cleanup 2023-07-22 22:50:05 +02:00
Jörg Breitbart 089dc282c3 fix hover underline 2023-07-22 22:18:12 +02:00
Jörg Breitbart 329b465a63 fix SP for underline/overline 2023-07-22 16:53:13 +02:00
Jörg Breitbart 6785dc19ab exclude combined from merge, fix linter 2023-07-22 16:32:01 +02:00
Jörg Breitbart c515cc2823 fix ext underline handling 2023-07-22 16:20:47 +02:00
Jörg Breitbart 848f89e8a7 fix char under cursor 2023-07-22 15:24:50 +02:00
Jörg Breitbart bd7f76190c fix superfluous selection.refresh calls 2023-07-22 15:12:37 +02:00
Jörg Breitbart 514afcd445 fix bad runtime of merger 2023-07-22 13:29:26 +02:00
Jörg Breitbart 3e13abf974 fix selection handling 2023-07-22 13:01:53 +02:00
Jörg Breitbart 4cfe32f626 make linter happy 2023-07-22 11:08:51 +02:00
Jörg Breitbart f36954764d faster DOM updates 2023-07-22 11:00:12 +02:00
Daniel Imms 1c98037eed Merge pull request #4599 from xtermjs/dependabot/npm_and_yarn/word-wrap-1.2.4
Bump word-wrap from 1.2.3 to 1.2.4
2023-07-18 14:55:34 -07:00
dependabot[bot] 2d732e3a99 Bump word-wrap from 1.2.3 to 1.2.4
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-18 21:27:19 +00:00
Daniel Imms 53d105714a Merge pull request #4596 from lewis-sanchez/lewissanchez/bug/rasterized-glyph-undefined
Add getRasterizedGlyph null and undefined check
2023-07-15 17:56:31 -07:00
Lewis Sanchez 78aad113a6 Minor clean up 2023-07-14 15:07:38 -07:00
Lewis Sanchez d2c28c819f Add getRasterizedGlyph null and undefined check 2023-07-14 11:31:59 -07:00
Daniel Imms 3d75333e95 Merge pull request #4595 from matifali/patch-1
Add Coder to the list
2023-07-14 07:48:40 -07:00
Muhammad Atif Ali 7e5bdb5321 Add Coder Self-Hosted Remote Development Environments to list 2023-07-14 14:08:34 +03:00
Daniel Imms be74969d70 Merge pull request #4589 from xtermjs/dependabot/npm_and_yarn/semver-5.7.2
Bump semver from 5.7.1 to 5.7.2
2023-07-11 04:35:17 -07:00
dependabot[bot] 196f863441 Bump semver from 5.7.1 to 5.7.2
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-11 10:14:24 +00:00
Daniel Imms 823258e311 Merge pull request #4587 from xtermjs/dependabot/npm_and_yarn/tough-cookie-4.1.3
Bump tough-cookie from 4.0.0 to 4.1.3
2023-07-09 08:55:23 -07:00
dependabot[bot] e100a4310b Bump tough-cookie from 4.0.0 to 4.1.3
Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.0.0 to 4.1.3.
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](https://github.com/salesforce/tough-cookie/compare/v4.0.0...v4.1.3)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-09 10:15:18 +00:00
Daniel Imms 681c912533 Merge pull request #4585 from tomgroenwoldt/add-helix-editor-playground-project
Add helix editor playground project to real world uses
2023-07-06 07:25:42 -07:00
Tom Groenwoldt 6339c09c01 Add helix editor playground project to real world uses 2023-07-06 11:36:23 +02:00
David Lechner 96634298e4 use border-bottom instead of box-shadow for underline cursor
In rare cases, box-shadow can cause aliasing artifacts on the top and
sides of the cursor box when only the bottom should be filled in to
create an underline.

This replaces the box-shadow style with border-bottom which should be
pixel perfect in all cases.

Fixes: https://github.com/xtermjs/xterm.js/issues/4580
2023-07-05 16:48:42 +00:00
Jörg Breitbart 65568f502e fix #4582 2023-07-05 13:56:41 +02:00
tisilent 1fb9f0185a format 2023-06-30 11:45:50 +08:00
tisilent 74c5256d6d using _smoothScroll 2023-06-30 11:44:06 +08:00
Per Bothner 556823328f Fix for lint the previous charProperties change. 2023-06-28 15:33:55 -07:00
Per Bothner dc6818de2b Fix error in charProperties optimization.
Result should be 2, not 1.
Use a static field to avoid this kind of error
(though it might be slightly slower, depending on the compiler/toolchain).
2023-06-28 15:19:44 -07:00
Per Bothner 693f6b2d14 Merge branch 'master' into clusters 2023-06-27 13:31:23 -07:00
Jörg Breitbart 3991b5f251 make linter happy 2023-06-27 17:11:45 +02:00
Jörg Breitbart 9afb924e84 different loop for failing test 2023-06-27 17:06:43 +02:00
Jörg Breitbart 7a82e7370f fix timeout issue again 2023-06-27 16:51:11 +02:00
Jörg Breitbart 709e9fd01a remove left over .only 2023-06-27 16:20:33 +02:00
Jörg Breitbart e16f87f973 use pollFor in failing test 2023-06-27 16:20:11 +02:00
Jörg Breitbart d4ddac704c more waits for remote browser under heavy CI load 2023-06-27 15:57:07 +02:00
Jörg Breitbart bc92d61616 remove left over .only 2023-06-27 15:41:54 +02:00
Jörg Breitbart 4884d81704 fix another heavy CI load timeout issue 2023-06-27 15:35:52 +02:00
Jörg Breitbart d99bdb7710 fix timeout issue in CI 2023-06-27 15:15:51 +02:00
Jörg Breitbart eaa265b4fa add image options and tests to demo 2023-06-27 15:04:55 +02:00
Jörg Breitbart 8fa3cae618 integrate addon into demo 2023-06-27 14:04:27 +02:00
Jörg Breitbart 0027b27ea3 add wasm builds 2023-06-27 13:49:49 +02:00
Jörg Breitbart 2bcc653293 remove only from api test 2023-06-27 13:43:02 +02:00
Jörg Breitbart ebfff5efee initial move to base repo 2023-06-27 13:35:59 +02:00
Daniel Imms ac0207bf2e Merge pull request #4570 from naufalafif/cloudtutor-io-patch-1
add cloudtutor.io to real world uses
2023-06-19 07:52:33 -07:00
naufal afif 8068880aab add cloudtutor.io to real world uses 2023-06-19 10:26:12 +08:00
Albert Safin 064fe0cfd9 Render the cursor in the WebGL canvas 2023-06-18 06:34:14 +00:00
Daniel Imms 096fe17135 Merge pull request #4565 from Tyriar/tyriar/readonly_log
Improve safety of log service
2023-06-16 10:42:47 -07:00
Daniel Imms 4d501b38b8 Improve safety of log service 2023-06-16 10:30:54 -07:00
Daniel Imms f79e9a1951 Merge pull request #4564 from Tyriar/bind_loggers
Bind logger calls
2023-06-16 09:30:04 -07:00
Daniel Imms 64a62fb0c1 Bind logger calls 2023-06-16 09:19:23 -07:00
Daniel Imms 2c45989fea Merge pull request #4563 from Tyriar/logger
Add logger delegate option
2023-06-16 08:34:13 -07:00
Daniel Imms f779e4ddc0 Add logger delegate option
This allows embedders to route the logs whereever they want, when this
is set the xterm.js prefix is excluded.
2023-06-16 08:23:22 -07:00
Daniel Imms 7be0016e45 Merge branch 'master' into #4121 2023-06-10 14:02:21 -07:00
Daniel Imms ac923e55d2 Merge pull request #4553 from Tyriar/v5_2_1
v5.2.1
2023-06-10 14:01:33 -07:00
Daniel Imms e08e5607ed v5.2.1 2023-06-10 13:59:51 -07:00
Daniel Imms 2ac2eeadfc Merge pull request #4551 from Tyriar/npes
Fix NPEs on buffer line and windowsPty option
2023-06-09 08:59:24 -07:00
Daniel Imms ffadc0b31d Fix NPEs on buffer line and windowsPty option 2023-06-09 08:47:17 -07:00
xie jialong 努力鸭 f616ebb083 Merge branch 'master' into #4121 2023-06-07 19:23:01 +08:00
tisilent ce2d115087 Move logic to Viewport 2023-06-06 20:14:24 +08:00
jerch cf403bc45c Merge branch 'master' into clusters 2023-05-21 22:25:34 +02:00
Per Bothner fa89e1776b Optimize UnicodeGraphemeProvider for the ASCII case. 2023-05-21 10:29:13 -07:00
Per Bothner 1a8c7dad5f Update .eslintrc.json to include xterm-addon-unicode-graphemes/benchmark 2023-05-21 10:27:36 -07:00
Per Bothner e87fa1600d Merge pull request #2 from jerch/clusters-patch
working perf test and API test injection
2023-05-21 08:19:55 -07:00
Jörg Breitbart 3003185676 revert wrongly editied files 2023-05-20 15:29:38 +02:00
Jörg Breitbart ebfa2018dd revert wrong added file 2023-05-20 15:28:15 +02:00
Jörg Breitbart 68abf10c25 remove spurious .only 2023-05-20 15:24:56 +02:00
Jörg Breitbart 284cde8b1b fix benchmark 2023-05-20 15:14:37 +02:00
Jörg Breitbart 466501c62f patch for working perf test and API test injection 2023-05-20 15:05:32 +02:00
Per Bothner 9c34bb4160 Merge branch 'master' into clusters 2023-05-18 11:19:26 -07:00
Per Bothner 8e730cdc61 xterm-addon-unicode-graphemes: add api tests and get demo working 2023-05-18 11:11:38 -07:00
Per Bothner 41760dfb09 xterm-addon-unicode-graphemes - fix 'yarn test' 2023-05-18 08:55:52 -07:00
Per Bothner 67e968926c Cleanup - fix various tests. 2023-05-17 18:37:27 -07:00
Per Bothner 2f7fe1189c New unicode-graphemes addon.
Handle grapheme cluster lookup as well as wcwidth.
This is based on Unicode 15, and could replace the unicode11 addon.
2023-05-16 18:31:31 -07:00
tisilent b7d73f63cd Add smoothScroll to scrollLines 2023-04-19 15:48:12 +08:00
Labhansh Agrawal a8cec5f02f Enable ligatures addon on electron 2023-02-23 23:49:40 +05:30
Arek Ouzounian 79d2f738a2 fixed linter warnings 2023-01-06 15:22:02 -08:00
Arek Ouzounian 7701557b99 Fix for #2488. Use element offsetHeight rather than
getBoundingRect
2023-01-06 14:56:20 -08:00
Simon Lamon ed8c2269cb Add proposed fix 2022-12-23 17:00:48 +00:00
Simon Lamon f1b47485cd Revert "Revert "SerializeAsHTML(): Fallback to default ansi colors when running headless terminal""
This reverts commit 3a81ef54ca.
2022-12-23 16:47:31 +00:00
368 changed files with 17484 additions and 8181 deletions
+67 -22
View File
@@ -1,7 +1,7 @@
{
"env": {
"browser": true,
"es6": true,
"es2021": true,
"node": true
},
"parser": "@typescript-eslint/parser",
@@ -13,27 +13,38 @@
"src/headless/tsconfig.json",
"test/api/tsconfig.json",
"test/benchmark/tsconfig.json",
"addons/xterm-addon-attach/src/tsconfig.json",
"addons/xterm-addon-attach/test/tsconfig.json",
"addons/xterm-addon-canvas/src/tsconfig.json",
"addons/xterm-addon-fit/src/tsconfig.json",
"addons/xterm-addon-fit/test/tsconfig.json",
"addons/xterm-addon-ligatures/src/tsconfig.json",
"addons/xterm-addon-search/src/tsconfig.json",
"addons/xterm-addon-search/test/tsconfig.json",
"addons/xterm-addon-serialize/src/tsconfig.json",
"addons/xterm-addon-serialize/test/tsconfig.json",
"addons/xterm-addon-serialize/benchmark/tsconfig.json",
"addons/xterm-addon-unicode11/src/tsconfig.json",
"addons/xterm-addon-unicode11/test/tsconfig.json",
"addons/xterm-addon-web-links/src/tsconfig.json",
"addons/xterm-addon-web-links/test/tsconfig.json",
"addons/xterm-addon-webgl/src/tsconfig.json",
"addons/xterm-addon-webgl/test/tsconfig.json"
"test/playwright/tsconfig.json",
"addons/addon-attach/src/tsconfig.json",
"addons/addon-attach/test/tsconfig.json",
"addons/addon-canvas/src/tsconfig.json",
"addons/addon-canvas/test/tsconfig.json",
"addons/addon-fit/src/tsconfig.json",
"addons/addon-fit/test/tsconfig.json",
"addons/addon-image/src/tsconfig.json",
"addons/addon-image/test/tsconfig.json",
"addons/addon-ligatures/src/tsconfig.json",
"addons/addon-search/src/tsconfig.json",
"addons/addon-search/test/tsconfig.json",
"addons/addon-serialize/src/tsconfig.json",
"addons/addon-serialize/test/tsconfig.json",
"addons/addon-serialize/benchmark/tsconfig.json",
"addons/addon-unicode11/src/tsconfig.json",
"addons/addon-unicode11/test/tsconfig.json",
"addons/addon-unicode-graphemes/src/tsconfig.json",
"addons/addon-unicode-graphemes/test/tsconfig.json",
"addons/addon-unicode-graphemes/benchmark/tsconfig.json",
"addons/addon-web-links/src/tsconfig.json",
"addons/addon-web-links/test/tsconfig.json",
"addons/addon-webgl/src/tsconfig.json",
"addons/addon-webgl/test/tsconfig.json"
],
"sourceType": "module"
},
"ignorePatterns": [
"addons/*/src/third-party/*.ts",
"out/*",
"out-test/*",
"**/inwasm-sdks/*",
"**/typings/*.d.ts",
"**/node_modules",
"**/*.js"
@@ -87,7 +98,12 @@
],
"@typescript-eslint/naming-convention": [
"warn",
{ "selector": "default", "format": ["camelCase"] },
{ "selector": "default", "format": ["camelCase"],
"filter": {
"regex": "^[a-z]",
"match": true
}
},
// variableLike
{ "selector": "variable", "format": ["camelCase", "UPPER_CASE"] },
{ "selector": "variable", "filter": "^I.+Service$", "format": ["PascalCase"], "prefix": ["I"] },
@@ -96,7 +112,12 @@
{ "selector": "memberLike", "modifiers": ["protected"], "format": ["camelCase"], "leadingUnderscore": "require" },
{ "selector": "enumMember", "format": ["UPPER_CASE"] },
// memberLike - Allow enum-like objects to use UPPER_CASE
{ "selector": "property", "modifiers": ["public"], "format": ["camelCase", "UPPER_CASE"] },
{ "selector": "property", "modifiers": ["public"], "format": ["camelCase", "UPPER_CASE"],
"filter": {
"regex": "^[a-z]",
"match": true
}
},
// restrict on* naming for events only
{ "selector": "method", "modifiers": ["public"], "format": ["camelCase", "UPPER_CASE"], "custom": {
"regex": "^on[A-Z].+",
@@ -114,6 +135,11 @@
{ "selector": "typeLike", "format": ["PascalCase"] },
{ "selector": "interface", "format": ["PascalCase"], "prefix": ["I"] }
],
"@typescript-eslint/no-confusing-void-expression": [
"warn",
{ "ignoreArrowShorthand": true }
],
"@typescript-eslint/no-useless-constructor": "warn",
"@typescript-eslint/prefer-namespace-keyword": "warn",
"@typescript-eslint/type-annotation-spacing": "warn",
"@typescript-eslint/quotes": [
@@ -146,6 +172,16 @@
"jsdoc/check-param-names": 1,
"jsdoc/no-multi-asterisks": 1,
"keyword-spacing": "warn",
"max-len": [
"warn",
{
"code": 1000, // Don't enforce for code
"comments": 100,
"ignoreTrailingComments": true,
"ignoreUrls": true,
"ignorePattern": "^ *((?<vt_comment>(//|\\*) @vt)|(?<table_comment>\\* \\| )|(?<commented_code>// ))"
}
],
"new-parens": "warn",
"no-duplicate-imports": "warn",
"no-else-return": [
@@ -189,6 +225,10 @@
],
"no-trailing-spaces": "warn",
"no-unsafe-finally": "warn",
"no-unused-vars": ["warn", {
"vars": "all",
"args": "none"
}],
"no-var": "warn",
"one-var": [
"warn",
@@ -210,9 +250,14 @@
},
"overrides": [
{
"files": ["**/*.test.ts"],
"files": [
"**/*.api.ts",
"**/*.test.ts"
],
"rules": {
"object-curly-spacing": "off"
"object-curly-spacing": "off",
"max-len": "off",
"no-unused-vars": "off"
}
}
]
+104
View File
@@ -0,0 +1,104 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"jsdoc"
],
"rules": {
"no-extra-semi": "error",
"@typescript-eslint/array-type": [
"warn",
{
"default": "array",
"readonly": "generic"
}
],
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
"allowExpressions": true
}
],
"@typescript-eslint/indent": [
"warn",
2
],
"@typescript-eslint/member-delimiter-style": [
"warn",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "comma",
"requireLast": false
}
}
],
"@typescript-eslint/naming-convention": [
"warn",
{ "selector": "typeLike", "format": ["PascalCase"] },
{ "selector": "interface", "format": ["PascalCase"], "prefix": ["I"] }
],
"@typescript-eslint/prefer-namespace-keyword": "warn",
"@typescript-eslint/type-annotation-spacing": "warn",
"@typescript-eslint/quotes": [
"warn",
"single",
{ "allowTemplateLiterals": true }
],
"@typescript-eslint/semi": [
"warn",
"always"
],
"comma-dangle": [
"warn",
{
"objects": "never",
"arrays": "never",
"functions": "never"
}
],
"curly": [
"warn",
"multi-line"
],
"eol-last": "warn",
"eqeqeq": [
"warn",
"always"
],
"jsdoc/check-alignment": 1,
"jsdoc/check-param-names": 1,
"keyword-spacing": "warn",
"max-len": [
"warn",
{
"code": 1000, // Don't enforce for code
"comments": 80,
"ignoreUrls": true,
"ignorePattern": "^ *(?<ps_description>\\* Ps=)"
}
],
"no-irregular-whitespace": "warn",
"no-trailing-spaces": "warn",
"object-curly-spacing": [
"warn",
"always"
],
"spaced-comment": [
"warn",
"always",
{
"markers": ["/"],
"exceptions": ["-"]
}
]
}
}
+312
View File
@@ -0,0 +1,312 @@
name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Build
run: yarn setup
- name: Zip artifacts
run: |
zip -r compressed-build \
./out/* \
./out-test/* \
./addons/addon-attach/out/* \
./addons/addon-attach/out-test/* \
./addons/addon-canvas/out/* \
./addons/addon-canvas/out-test/* \
./addons/addon-fit/out/* \
./addons/addon-fit/out-test/* \
./addons/addon-image/out/* \
./addons/addon-image/out-test/* \
./addons/addon-ligatures/out/* \
./addons/addon-ligatures/out-test/* \
./addons/addon-search/out/* \
./addons/addon-search/out-test/* \
./addons/addon-serialize/out/* \
./addons/addon-serialize/out-test/* \
./addons/addon-unicode11/out/* \
./addons/addon-unicode11/out-test/* \
./addons/addon-unicode-graphemes/out/* \
./addons/addon-unicode-graphemes/out-test/* \
./addons/addon-web-links/out/* \
./addons/addon-web-links/out-test/* \
./addons/addon-webgl/out/* \
./addons/addon-webgl/out-test/*
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: compressed-build.zip
if-no-files-found: error
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
- name: Lint code
env:
NODE_OPTIONS: --max_old_space_size=4096
run: yarn lint
- name: Lint API
run: yarn lint-api
test-unit-coverage:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
- uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Unzip artifacts
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
else
unzip -o compressed-build.zip
fi
ls -R
- name: Unit test coverage
run: |
yarn test-unit-coverage --forbid-only
EXIT_CODE=$?
./node_modules/.bin/nyc report --reporter=cobertura
exit $EXIT_CODE
test-unit-parallel:
timeout-minutes: 20
strategy:
matrix:
node-version: [18]
runs-on: [ubuntu, macos, windows]
runs-on: ${{ matrix.runs-on }}-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
- name: Wait for build job
uses: NathanFirmo/wait-for-other-job@v1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
job: build
- uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Unzip artifacts
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
else
unzip -o compressed-build.zip
fi
ls -R
- name: Unit tests
run: yarn test-unit --forbid-only
test-api-parallel:
timeout-minutes: 20
strategy:
matrix:
node-version: [18] # just one as integration tests are about testing in browser
runs-on: [ubuntu] # macos is flaky
browser: [chromium, firefox]
runs-on: ${{ matrix.runs-on }}-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
- name: Install playwright
run: npx playwright install
- name: Wait for build job
uses: NathanFirmo/wait-for-other-job@v1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
job: build
- uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Unzip artifacts
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
else
unzip -o compressed-build.zip
fi
ls -R
- name: Integration tests (${{ matrix.browser }})
run: yarn test-api-${{ matrix.browser }} --headless --forbid-only
test-playwright-parallel:
timeout-minutes: 20
strategy:
matrix:
node-version: [18] # just one as integration tests are about testing in browser
runs-on: [ubuntu] # macos is flaky
browser: [chromium, firefox, webkit]
runs-on: ${{ matrix.runs-on }}-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
- name: Install playwright
run: npx playwright install --with-deps ${{ matrix.browser }}
- name: Wait for build job
uses: NathanFirmo/wait-for-other-job@v1.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
job: build
- uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Unzip artifacts
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
else
unzip -o compressed-build.zip
fi
ls -R
- name: Build demo
run: yarn build-demo
- name: Integration tests (core) # Tests use 50% workers to reduce flakiness
run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=core
- name: Integration tests (addon-canvas)
run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-canvas
- name: Integration tests (addon-webgl)
run: yarn test-playwright-${{ matrix.browser }} --workers=50% --forbid-only --suite=addon-webgl
test-api:
needs: build
timeout-minutes: 20
strategy:
matrix:
node-version: [18] # just one as integration tests are about testing in browser
runs-on: [windows] # macos is flaky
browser: [chromium, firefox]
runs-on: ${{ matrix.runs-on }}-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
- name: Install playwright
run: npx playwright install
- uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Unzip artifacts
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
else
unzip -o compressed-build.zip
fi
ls -R
- name: Integration tests (${{ matrix.browser }})
run: yarn test-api-${{ matrix.browser }} --headless --forbid-only
release-dry-run:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}.x
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
cache: 'yarn'
- name: Install dependencies
run: |
yarn --frozen-lockfile
yarn install-addons
- name: Install playwright
run: npx playwright install
- uses: actions/download-artifact@v3
with:
name: build-artifacts
- name: Unzip artifacts
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
pwsh -Command "7z x compressed-build.zip -aoa -o${{ github.workspace }}"
else
unzip -o compressed-build.zip
fi
ls -R
- name: Package headless
run: |
yarn package-headless
node ./bin/package_headless.js
- name: Publish to npm (dry run)
run: node ./bin/publish.js --dry
-37
View File
@@ -1,21 +1,9 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '41 17 * * 0'
@@ -33,40 +21,15 @@ jobs:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
+30
View File
@@ -0,0 +1,30 @@
name: Release
on:
push:
# If a commit reaches master, assume it has passed CI via PR and publish
# without running tests to save time to publish
branches: [ "master" ]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Build
run: yarn setup
- name: Package headless
run: |
yarn package-headless
node ./bin/package_headless.js
- name: Publish to npm
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: node ./bin/publish.js
+1
View File
@@ -0,0 +1 @@
16
+11 -6
View File
@@ -43,7 +43,14 @@
{
"type": "chrome",
"request": "launch",
"name": "Demo Client",
"name": "Demo Client (Chrome)",
"url": "http://127.0.0.1:3000",
"webRoot": "${workspaceFolder}/"
},
{
"type": "msedge",
"request": "launch",
"name": "Demo Client (Edge)",
"url": "http://127.0.0.1:3000",
"webRoot": "${workspaceFolder}/"
},
@@ -52,11 +59,9 @@
"request": "launch",
"name": "Demo Server",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"start-debug"
],
"port": 9229,
"runtimeArgs": ["start"],
"stopOnEntry": true,
"runtimeVersion": "16",
"serverReadyAction": {
"action": "openExternally",
"pattern": "App listening to (http://.*?:[0-9]+)"
+3
View File
@@ -1,4 +1,7 @@
{
"files.associations": {
".eslintrc.json.typings": "jsonc"
},
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.quoteStyle": "single",
"mochaExplorer.envPath": ".mocha.env",
+4
View File
@@ -28,6 +28,10 @@ opening an issue, read these pointers.
- Be polite. Issues with an indignant or belligerent tone tend to be moved to the
bottom of the pile.
## Answering discussion questions
Issues are only meant to track (likely) feature requests and bugs. We use [GitHub Discussions](https://github.com/xtermjs/xterm.js/discussions) for general Q&A as well as discussing possible features. If you want to help out, many questions get asked over at the [discussions page](https://github.com/xtermjs/xterm.js/discussions) which could use an expert as the core team is often stretched thin.
## Contributing code
You can find issues to work on by looking at the [help wanted](https://github.com/xtermjs/xterm.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) or [good first issue](https://github.com/xtermjs/xterm.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) issues. It's a good idea to comment on the issue saying that you're taking it, just in case someone else comes along and you duplicate work. Once you have your issue, here are the steps to contribute:
+16 -10
View File
@@ -1,7 +1,5 @@
# [![xterm.js logo](logo-full.png)](https://xtermjs.org)
[![Build Status](https://dev.azure.com/xtermjs/xterm.js/_apis/build/status/xtermjs.xterm.js)](https://dev.azure.com/xtermjs/xterm.js/_build/latest?definitionId=3)
Xterm.js is a front-end component written in TypeScript that lets applications bring fully-featured terminals to their users in the browser. It's used by popular projects such as VS Code, Hyper and Theia.
## Features
@@ -51,7 +49,7 @@ To start using xterm.js on your browser, add the `xterm.js` and `xterm.css` to t
The recommended way to load xterm.js is via the ES6 module syntax:
```javascript
import { Terminal } from 'xterm';
import { Terminal } from '@xterm/xterm';
```
### Addons
@@ -61,14 +59,14 @@ import { Terminal } from 'xterm';
Addons are separate modules that extend the `Terminal` by building on the [xterm.js API](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts). To use an addon, you first need to install it in your project:
```bash
npm i -S xterm-addon-web-links
npm i -S @xterm/addon-web-links
```
Then import the addon, instantiate it and call `Terminal.loadAddon`:
```ts
import { Terminal } from 'xterm';
import { WebLinksAddon } from 'xterm-addon-web-links';
import { Terminal } from '@xterm/xterm';
import { WebLinksAddon } from '@xterm/addon-web-links';
const terminal = new Terminal();
// Load WebLinksAddon on terminal, this is all that's needed to get web links
@@ -78,10 +76,15 @@ terminal.loadAddon(new WebLinksAddon());
The xterm.js team maintains the following addons, but anyone can build them:
- [`xterm-addon-attach`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-attach): Attaches to a server running a process via a websocket
- [`xterm-addon-fit`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-fit): Fits the terminal to the containing element
- [`xterm-addon-search`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-search): Adds search functionality
- [`xterm-addon-web-links`](https://github.com/xtermjs/xterm.js/tree/master/addons/xterm-addon-web-links): Adds web link detection and interaction
- [`@xterm/addon-attach`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-attach): Attaches to a server running a process via a websocket
- [`@xterm/addon-canvas`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-canvas): Renders xterm.js using a `canvas` element's 2d context
- [`@xterm/addon-fit`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-fit): Fits the terminal to the containing element
- [`@xterm/addon-image`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-image): Adds image support
- [`@xterm/addon-search`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-search): Adds search functionality
- [`@xterm/addon-serialize`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-serialize): Serializes the terminal's buffer to a VT sequences or HTML
- [`@xterm/addon-unicode11`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-unicode11): Updates character widths to their unicode11 values
- [`@xterm/addon-web-links`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-web-links): Adds web link detection and interaction
- [`@xterm/addon-webgl`](https://github.com/xtermjs/xterm.js/tree/master/addons/addon-webgl): Renders xterm.js using a `canvas` element's webgl2 context
## Browser Support
@@ -216,6 +219,9 @@ Xterm.js is used in several world-class applications to provide great terminal e
- [**Super Terminal**](https://github.com/bugwheels94/super-terminal): It is a http based terminal for developers who dont like repetition and save time.
- [**graSSHopper**](https://grasshopper.coding.kiwi): A simple SSH client with file explorer, history and many more features.
- [**DomTerm**](https://domterm.org/xtermjs.html): Tiles and tabs. Detachable sessions (like tmux). [Remote connections](https://domterm.org/Remoting-over-ssh.html) using a nice ssh wrapper with predictive echo. Qt, Electron, Tauri/Wry, or desktop browser front-ends. Choose between xterm.js engine (faster) or native DomTerm (more functionality and graphics) - or both.
- [**Cloudtutor.io**](https://cloudtutor.io): innovative online learning platform that offers users access to an interactive lab.
- [**Helix Editor Playground**](https://github.com/tomgroenwoldt/helix-editor-playground): Online playground for the terminal based helix editor.
- [**Coder**](https://github.com/coder/coder): Self-Hosted Remote Development Environments
- [And much more...](https://github.com/xtermjs/xterm.js/network/dependents?package_id=UGFja2FnZS0xNjYzMjc4OQ%3D%3D)
Do you use xterm.js in your application as well? Please [open a Pull Request](https://github.com/sourcelair/xterm.js/pulls) to include it here. We would love to have it on our list. Note: Please add any new contributions to the end of the list only.
@@ -1,22 +1,22 @@
## xterm-addon-attach
## @xterm/addon-attach
An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables attaching to a web socket. This addon requires xterm.js v4+.
### Install
```bash
npm install --save xterm-addon-attach
npm install --save @xterm/addon-attach
```
### Usage
```ts
import { Terminal } from 'xterm';
import { AttachAddon } from 'xterm-addon-attach';
import { Terminal } from '@xterm/xterm';
import { AttachAddon } from '@xterm/addon-attach';
const terminal = new Terminal();
const attachAddon = new AttachAddon(webSocket);
terminal.loadAddon(attachAddon);
```
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-attach/typings/xterm-addon-attach.d.ts) for more advanced usage.
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-attach/typings/addon-attach.d.ts) for more advanced usage.
@@ -1,17 +1,16 @@
{
"name": "xterm-addon-canvas",
"version": "0.4.0",
"name": "@xterm/addon-attach",
"version": "0.10.0",
"author": {
"name": "The xterm.js authors",
"url": "https://xtermjs.org/"
},
"main": "lib/xterm-addon-canvas.js",
"types": "typings/xterm-addon-canvas.d.ts",
"repository": "https://github.com/xtermjs/xterm.js",
"main": "lib/addon-attach.js",
"types": "typings/addon-attach.d.ts",
"repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-attach",
"license": "MIT",
"keywords": [
"terminal",
"canvas",
"xterm",
"xterm.js"
],
@@ -22,6 +21,6 @@
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
@@ -5,13 +5,14 @@
* Implements the attach method, that attaches the terminal to a WebSocket stream.
*/
import { Terminal, IDisposable, ITerminalAddon } from 'xterm';
import type { Terminal, IDisposable, ITerminalAddon } from '@xterm/xterm';
import type { AttachAddon as IAttachApi } from '@xterm/addon-attach';
interface IAttachOptions {
bidirectional?: boolean;
}
export class AttachAddon implements ITerminalAddon {
export class AttachAddon implements ITerminalAddon , IAttachApi {
private _socket: WebSocket;
private _bidirectional: boolean;
private _disposables: IDisposable[] = [];
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"target": "es2021",
"lib": [
"dom",
"es2015"
@@ -13,7 +13,12 @@
"strict": true,
"types": [
"../../../node_modules/@types/mocha"
]
],
"paths": {
"@xterm/addon-attach": [
"../typings/addon-attach.d.ts"
]
}
},
"include": [
"./**/*",
@@ -5,7 +5,7 @@
import WebSocket = require('ws');
import { openTerminal, pollFor, launchBrowser } from '../../../out-test/api/TestUtils';
import { Browser, Page } from 'playwright';
import { Browser, Page } from '@playwright/test';
const APP = 'http://127.0.0.1:3001/test';
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"target": "es2021",
"lib": [
"es2015"
],
@@ -3,9 +3,9 @@
* @license MIT
*/
import { Terminal, ITerminalAddon } from 'xterm';
import { Terminal, ITerminalAddon } from '@xterm/xterm';
declare module 'xterm-addon-attach' {
declare module '@xterm/addon-attach' {
export interface IAttachOptions {
/**
* Whether input should be written to the backend. Defaults to `true`.
@@ -6,7 +6,7 @@
const path = require('path');
const addonName = 'AttachAddon';
const mainFile = 'xterm-addon-attach.js';
const mainFile = 'addon-attach.js';
module.exports = {
entry: `./out/${addonName}.js`,
+28
View File
@@ -0,0 +1,28 @@
## @xterm/addon-canvas
An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a canvas-based renderer using a 2d context to draw. This addon requires xterm.js v5+.
The purpose of this addon is to be used as a fallback for the [webgl addon](https://www.npmjs.com/package/@xterm/addon-webgl) when better performance is desired over the default DOM renderer, but WebGL2 isn't supported or performant for some reason.
### Install
```bash
npm install --save @xterm/addon-canvas
```
### Usage
```ts
import { Terminal } from '@xterm/xterm';
import { CanvasAddon } from '@xterm/addon-canvas';
const terminal = new Terminal();
terminal.open(element);
terminal.loadAddon(new CanvasAddon());
```
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-canvas/typings/addon-canvas.d.ts) for more advanced usage.
### See also
- [@xterm/addon-webgl](https://www.npmjs.com/package/@xterm/addon-webgl) A renderer for xterm.js that uses WebGL
+28
View File
@@ -0,0 +1,28 @@
{
"name": "@xterm/addon-canvas",
"version": "0.6.0",
"author": {
"name": "The xterm.js authors",
"url": "https://xtermjs.org/"
},
"main": "lib/addon-canvas.js",
"types": "typings/addon-canvas.d.ts",
"repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-canvas",
"license": "MIT",
"keywords": [
"terminal",
"canvas",
"xterm",
"xterm.js"
],
"scripts": {
"build": "../../node_modules/.bin/tsc -p .",
"prepackage": "npm run build",
"package": "../../node_modules/.bin/webpack",
"prepublishOnly": "npm run package",
"start-server-only": "node ../../demo/start-server-only"
},
"peerDependencies": {
"@xterm/xterm": "^5.0.0"
}
}
@@ -3,24 +3,24 @@
* @license MIT
*/
import { ReadonlyColorSet } from 'browser/Types';
import { CellColorResolver } from 'browser/renderer/shared/CellColorResolver';
import { acquireTextureAtlas } from 'browser/renderer/shared/CharAtlasCache';
import { TEXT_BASELINE } from 'browser/renderer/shared/Constants';
import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { IRasterizedGlyph, IRenderDimensions, ISelectionRenderModel, ITextureAtlas } from 'browser/renderer/shared/Types';
import { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';
import { IRasterizedGlyph, IRenderDimensions, ISelectionRenderModel, ITextureAtlas } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { ReadonlyColorSet } from 'browser/Types';
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { isSafari } from 'common/Platform';
import { ICellData } from 'common/Types';
import { CellData } from 'common/buffer/CellData';
import { WHITESPACE_CELL_CODE } from 'common/buffer/Constants';
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
import { ICellData, IDisposable } from 'common/Types';
import { Terminal } from 'xterm';
import { Terminal } from '@xterm/xterm';
import { IRenderLayer } from './Types';
import { CellColorResolver } from 'browser/renderer/shared/CellColorResolver';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { isSafari } from 'common/Platform';
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
export abstract class BaseRenderLayer extends Disposable implements IRenderLayer {
private _canvas: HTMLCanvasElement;
@@ -37,7 +37,7 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
private _bitmapGenerator: (BitmapGenerator | undefined)[] = [];
protected _charAtlas!: ITextureAtlas;
private _charAtlasDisposable?: IDisposable;
protected _charAtlasDisposable = this.register(new MutableDisposable());
public get canvas(): HTMLCanvasElement { return this._canvas; }
public get cacheCanvas(): HTMLCanvasElement { return this._charAtlas?.pages[0].canvas!; }
@@ -58,8 +58,8 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
protected readonly _coreBrowserService: ICoreBrowserService
) {
super();
this._cellColorResolver = new CellColorResolver(this._terminal, this._selectionModel, this._decorationService, this._coreBrowserService, this._themeService);
this._canvas = document.createElement('canvas');
this._cellColorResolver = new CellColorResolver(this._terminal, this._optionsService, this._selectionModel, this._decorationService, this._coreBrowserService, this._themeService);
this._canvas = this._coreBrowserService.mainDocument.createElement('canvas');
this._canvas.classList.add(`xterm-${id}-layer`);
this._canvas.style.zIndex = zIndex.toString();
this._initCanvas();
@@ -74,7 +74,6 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
this.register(toDisposable(() => {
this._canvas.remove();
this._charAtlas?.dispose();
}));
}
@@ -92,7 +91,7 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
public handleGridChanged(startRow: number, endRow: number): void {}
public handleSelectionChanged(start: [number, number] | undefined, end: [number, number] | undefined, columnSelectMode: boolean = false): void {
this._selectionModel.update(this._terminal, start, end, columnSelectMode);
this._selectionModel.update((this._terminal as any)._core, start, end, columnSelectMode);
}
protected _setTransparency(alpha: boolean): void {
@@ -122,9 +121,8 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
if (this._deviceCharWidth <= 0 && this._deviceCharHeight <= 0) {
return;
}
this._charAtlasDisposable?.dispose();
this._charAtlas = acquireTextureAtlas(this._terminal, this._optionsService.rawOptions, colorSet, this._deviceCellWidth, this._deviceCellHeight, this._deviceCharWidth, this._deviceCharHeight, this._coreBrowserService.dpr);
this._charAtlasDisposable = forwardEvent(this._charAtlas.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas);
this._charAtlasDisposable.value = forwardEvent(this._charAtlas.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas);
this._charAtlas.warmUp();
for (let i = 0; i < this._charAtlas.pages.length; i++) {
this._bitmapGenerator[i] = new BitmapGenerator(this._charAtlas.pages[i].canvas);
@@ -367,12 +365,17 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
*/
protected _drawChars(cell: ICellData, x: number, y: number): void {
const chars = cell.getChars();
this._cellColorResolver.resolve(cell, x, this._bufferService.buffer.ydisp + y);
this._cellColorResolver.resolve(cell, x, this._bufferService.buffer.ydisp + y, this._deviceCellWidth);
if (!this._charAtlas) {
return;
}
let glyph: IRasterizedGlyph;
if (chars && chars.length > 1) {
glyph = this._charAtlas.getRasterizedGlyphCombinedChar(chars, this._cellColorResolver.result.bg, this._cellColorResolver.result.fg, this._cellColorResolver.result.ext);
glyph = this._charAtlas.getRasterizedGlyphCombinedChar(chars, this._cellColorResolver.result.bg, this._cellColorResolver.result.fg, this._cellColorResolver.result.ext, true);
} else {
glyph = this._charAtlas.getRasterizedGlyph(cell.getCode() || WHITESPACE_CELL_CODE, this._cellColorResolver.result.bg, this._cellColorResolver.result.fg, this._cellColorResolver.result.ext);
glyph = this._charAtlas.getRasterizedGlyph(cell.getCode() || WHITESPACE_CELL_CODE, this._cellColorResolver.result.bg, this._cellColorResolver.result.fg, this._cellColorResolver.result.ext, true);
}
if (!glyph.size.x || !glyph.size.y) {
return;
@@ -3,15 +3,17 @@
* @license MIT
*/
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';
import type { ITerminalAddon, Terminal } from '@xterm/xterm';
import type { CanvasAddon as ICanvasApi } from '@xterm/addon-canvas';
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import { ITerminal } from 'browser/Types';
import { CanvasRenderer } from './CanvasRenderer';
import { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';
import { ITerminalAddon, Terminal } from 'xterm';
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { setTraceLogger } from 'common/services/LogService';
import { IBufferService, IDecorationService, ILogService } from 'common/services/Services';
import { CanvasRenderer } from './CanvasRenderer';
export class CanvasAddon extends Disposable implements ITerminalAddon {
export class CanvasAddon extends Disposable implements ITerminalAddon , ICanvasApi {
private _terminal?: Terminal;
private _renderer?: CanvasRenderer;
@@ -35,7 +37,7 @@ export class CanvasAddon extends Disposable implements ITerminalAddon {
const coreService = core.coreService;
const optionsService = core.optionsService;
const screenElement = core.screenElement!;
const linkifier = core.linkifier2;
const linkifier = core.linkifier!;
const unsafeCore = core as any;
const bufferService: IBufferService = unsafeCore._bufferService;
@@ -44,8 +46,13 @@ export class CanvasAddon extends Disposable implements ITerminalAddon {
const charSizeService: ICharSizeService = unsafeCore._charSizeService;
const coreBrowserService: ICoreBrowserService = unsafeCore._coreBrowserService;
const decorationService: IDecorationService = unsafeCore._decorationService;
const logService: ILogService = unsafeCore._logService;
const themeService: IThemeService = unsafeCore._themeService;
// Set trace logger just in case it hasn't been yet which could happen when the addon is
// bundled separately to the core module
setTraceLogger(logService);
this._renderer = new CanvasRenderer(terminal, screenElement, linkifier, bufferService, charSizeService, optionsService, characterJoinerService, coreService, coreBrowserService, decorationService, themeService);
this.register(forwardEvent(this._renderer.onChangeTextureAtlas, this._onChangeTextureAtlas));
this.register(forwardEvent(this._renderer.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas));
@@ -59,4 +66,8 @@ export class CanvasAddon extends Disposable implements ITerminalAddon {
this._renderer = undefined;
}));
}
public clearTextureAtlas(): void {
this._renderer?.clearTextureAtlas();
}
}
@@ -3,16 +3,16 @@
* @license MIT
*/
import { ILinkifier2 } from 'browser/Types';
import { removeTerminalFromCache } from 'browser/renderer/shared/CharAtlasCache';
import { observeDevicePixelDimensions } from 'browser/renderer/shared/DevicePixelObserver';
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, ISelectionService, IThemeService } from 'browser/services/Services';
import { ILinkifier2 } from 'browser/Types';
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { EventEmitter, forwardEvent } from 'common/EventEmitter';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';
import { Terminal } from 'xterm';
import { Terminal } from '@xterm/xterm';
import { CursorRenderLayer } from './CursorRenderLayer';
import { LinkRenderLayer } from './LinkRenderLayer';
import { SelectionRenderLayer } from './SelectionRenderLayer';
@@ -22,6 +22,7 @@ import { IRenderLayer } from './Types';
export class CanvasRenderer extends Disposable implements IRenderer {
private _renderLayers: IRenderLayer[];
private _devicePixelRatio: number;
private _observerDisposable = this.register(new MutableDisposable());
public dimensions: IRenderDimensions;
@@ -60,7 +61,11 @@ export class CanvasRenderer extends Disposable implements IRenderer {
this._devicePixelRatio = this._coreBrowserService.dpr;
this._updateDimensions();
this.register(observeDevicePixelDimensions(this._renderLayers[0].canvas, this._coreBrowserService.window, (w, h) => this._setCanvasDevicePixelDimensions(w, h)));
this._observerDisposable.value = observeDevicePixelDimensions(this._renderLayers[0].canvas, this._coreBrowserService.window, (w, h) => this._setCanvasDevicePixelDimensions(w, h));
this.register(this._coreBrowserService.onWindowChange(w => {
this._observerDisposable.value = observeDevicePixelDimensions(this._renderLayers[0].canvas, w, (w, h) => this._setCanvasDevicePixelDimensions(w, h));
}));
this.register(toDisposable(() => {
for (const l of this._renderLayers) {
l.dispose();
@@ -3,17 +3,17 @@
* @license MIT
*/
import { CursorBlinkStateManager } from 'browser/renderer/shared/CursorBlinkStateManager';
import { IRenderDimensions, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
import { BaseRenderLayer } from './BaseRenderLayer';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { IEventEmitter } from 'common/EventEmitter';
import { MutableDisposable } from 'common/Lifecycle';
import { isFirefox } from 'common/Platform';
import { ICellData } from 'common/Types';
import { CellData } from 'common/buffer/CellData';
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
import { IBufferService, IOptionsService, ICoreService, IDecorationService } from 'common/services/Services';
import { IEventEmitter } from 'common/EventEmitter';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { Terminal } from 'xterm';
import { toDisposable } from 'common/Lifecycle';
import { isFirefox } from 'common/Platform';
import { IBufferService, ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
import { BaseRenderLayer } from './BaseRenderLayer';
interface ICursorState {
x: number;
@@ -23,15 +23,10 @@ interface ICursorState {
width: number;
}
/**
* The time between cursor blinks.
*/
const BLINK_INTERVAL = 600;
export class CursorRenderLayer extends BaseRenderLayer {
private _state: ICursorState;
private _cursorRenderers: {[key: string]: (x: number, y: number, cell: ICellData) => void};
private _cursorBlinkStateManager: CursorBlinkStateManager | undefined;
private _cursorBlinkStateManager: MutableDisposable<CursorBlinkStateManager> = this.register(new MutableDisposable());
private _cell: ICellData = new CellData();
constructor(
@@ -57,13 +52,11 @@ export class CursorRenderLayer extends BaseRenderLayer {
this._cursorRenderers = {
'bar': this._renderBarCursor.bind(this),
'block': this._renderBlockCursor.bind(this),
'underline': this._renderUnderlineCursor.bind(this)
'underline': this._renderUnderlineCursor.bind(this),
'outline': this._renderOutlineCursor.bind(this)
};
this.register(optionsService.onOptionChange(() => this._handleOptionsChanged()));
this.register(toDisposable(() => {
this._cursorBlinkStateManager?.dispose();
this._cursorBlinkStateManager = undefined;
}));
this._handleOptionsChanged();
}
public resize(dim: IRenderDimensions): void {
@@ -80,30 +73,27 @@ export class CursorRenderLayer extends BaseRenderLayer {
public reset(): void {
this._clearCursor();
this._cursorBlinkStateManager?.restartBlinkAnimation();
this._cursorBlinkStateManager.value?.restartBlinkAnimation();
this._handleOptionsChanged();
}
public handleBlur(): void {
this._cursorBlinkStateManager?.pause();
this._cursorBlinkStateManager.value?.pause();
this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });
}
public handleFocus(): void {
this._cursorBlinkStateManager?.resume();
this._cursorBlinkStateManager.value?.resume();
this._onRequestRedraw.fire({ start: this._bufferService.buffer.y, end: this._bufferService.buffer.y });
}
private _handleOptionsChanged(): void {
if (this._optionsService.rawOptions.cursorBlink) {
if (!this._cursorBlinkStateManager) {
this._cursorBlinkStateManager = new CursorBlinkStateManager(this._coreBrowserService.isFocused, () => {
this._render(true);
}, this._coreBrowserService);
if (!this._cursorBlinkStateManager.value) {
this._cursorBlinkStateManager.value = new CursorBlinkStateManager(() => this._render(true), this._coreBrowserService);
}
} else {
this._cursorBlinkStateManager?.dispose();
this._cursorBlinkStateManager = undefined;
this._cursorBlinkStateManager.clear();
}
// Request a refresh from the terminal as management of rendering is being
// moved back to the terminal
@@ -111,14 +101,14 @@ export class CursorRenderLayer extends BaseRenderLayer {
}
public handleCursorMove(): void {
this._cursorBlinkStateManager?.restartBlinkAnimation();
this._cursorBlinkStateManager.value?.restartBlinkAnimation();
}
public handleGridChanged(startRow: number, endRow: number): void {
if (!this._cursorBlinkStateManager || this._cursorBlinkStateManager.isPaused) {
if (!this._cursorBlinkStateManager.value || this._cursorBlinkStateManager.value.isPaused) {
this._render(false);
} else {
this._cursorBlinkStateManager.restartBlinkAnimation();
this._cursorBlinkStateManager.value.restartBlinkAnimation();
}
}
@@ -150,7 +140,10 @@ export class CursorRenderLayer extends BaseRenderLayer {
this._ctx.save();
this._ctx.fillStyle = this._themeService.colors.cursor.css;
const cursorStyle = this._optionsService.rawOptions.cursorStyle;
this._renderBlurCursor(cursorX, viewportRelativeCursorY, this._cell);
const cursorInactiveStyle = this._optionsService.rawOptions.cursorInactiveStyle;
if (cursorInactiveStyle && cursorInactiveStyle !== 'none') {
this._cursorRenderers[cursorInactiveStyle](cursorX, viewportRelativeCursorY, this._cell);
}
this._ctx.restore();
this._state.x = cursorX;
this._state.y = viewportRelativeCursorY;
@@ -161,7 +154,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
}
// Don't draw the cursor if it's blinking
if (this._cursorBlinkStateManager && !this._cursorBlinkStateManager.isCursorVisible) {
if (this._cursorBlinkStateManager.value && !this._cursorBlinkStateManager.value.isCursorVisible) {
this._clearCursor();
return;
}
@@ -231,146 +224,10 @@ export class CursorRenderLayer extends BaseRenderLayer {
this._ctx.restore();
}
private _renderBlurCursor(x: number, y: number, cell: ICellData): void {
private _renderOutlineCursor(x: number, y: number, cell: ICellData): void {
this._ctx.save();
this._ctx.strokeStyle = this._themeService.colors.cursor.css;
this._strokeRectAtCell(x, y, cell.getWidth(), 1);
this._ctx.restore();
}
}
class CursorBlinkStateManager {
public isCursorVisible: boolean;
private _animationFrame: number | undefined;
private _blinkStartTimeout: number | undefined;
private _blinkInterval: number | undefined;
/**
* The time at which the animation frame was restarted, this is used on the
* next render to restart the timers so they don't need to restart the timers
* multiple times over a short period.
*/
private _animationTimeRestarted: number | undefined;
constructor(
isFocused: boolean,
private _renderCallback: () => void,
private _coreBrowserService: ICoreBrowserService
) {
this.isCursorVisible = true;
if (isFocused) {
this._restartInterval();
}
}
public get isPaused(): boolean { return !(this._blinkStartTimeout || this._blinkInterval); }
public dispose(): void {
if (this._blinkInterval) {
this._coreBrowserService.window.clearInterval(this._blinkInterval);
this._blinkInterval = undefined;
}
if (this._blinkStartTimeout) {
this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout);
this._blinkStartTimeout = undefined;
}
if (this._animationFrame) {
this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
this._animationFrame = undefined;
}
}
public restartBlinkAnimation(): void {
if (this.isPaused) {
return;
}
// Save a timestamp so that the restart can be done on the next interval
this._animationTimeRestarted = Date.now();
// Force a cursor render to ensure it's visible and in the correct position
this.isCursorVisible = true;
if (!this._animationFrame) {
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {
this._renderCallback();
this._animationFrame = undefined;
});
}
}
private _restartInterval(timeToStart: number = BLINK_INTERVAL): void {
// Clear any existing interval
if (this._blinkInterval) {
this._coreBrowserService.window.clearInterval(this._blinkInterval);
this._blinkInterval = undefined;
}
// Setup the initial timeout which will hide the cursor, this is done before
// the regular interval is setup in order to support restarting the blink
// animation in a lightweight way (without thrashing clearInterval and
// setInterval).
this._blinkStartTimeout = this._coreBrowserService.window.setTimeout(() => {
// Check if another animation restart was requested while this was being
// started
if (this._animationTimeRestarted) {
const time = BLINK_INTERVAL - (Date.now() - this._animationTimeRestarted);
this._animationTimeRestarted = undefined;
if (time > 0) {
this._restartInterval(time);
return;
}
}
// Hide the cursor
this.isCursorVisible = false;
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {
this._renderCallback();
this._animationFrame = undefined;
});
// Setup the blink interval
this._blinkInterval = this._coreBrowserService.window.setInterval(() => {
// Adjust the animation time if it was restarted
if (this._animationTimeRestarted) {
// calc time diff
// Make restart interval do a setTimeout initially?
const time = BLINK_INTERVAL - (Date.now() - this._animationTimeRestarted);
this._animationTimeRestarted = undefined;
this._restartInterval(time);
return;
}
// Invert visibility and render
this.isCursorVisible = !this.isCursorVisible;
this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => {
this._renderCallback();
this._animationFrame = undefined;
});
}, BLINK_INTERVAL);
}, timeToStart);
}
public pause(): void {
this.isCursorVisible = true;
if (this._blinkInterval) {
this._coreBrowserService.window.clearInterval(this._blinkInterval);
this._blinkInterval = undefined;
}
if (this._blinkStartTimeout) {
this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout);
this._blinkStartTimeout = undefined;
}
if (this._animationFrame) {
this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
this._animationFrame = undefined;
}
}
public resume(): void {
// Clear out any existing timers just in case
this.pause();
this._animationTimeRestarted = undefined;
this._restartInterval();
this.restartBlinkAnimation();
}
}
@@ -3,14 +3,14 @@
* @license MIT
*/
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { BaseRenderLayer } from './BaseRenderLayer';
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { IColorSet, ILinkifierEvent, ILinkifier2, ReadonlyColorSet } from 'browser/Types';
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
import { ILinkifier2, ILinkifierEvent } from 'browser/Types';
import { is256Color } from 'browser/renderer/shared/CharAtlasUtils';
import { Terminal } from 'xterm';
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
import { BaseRenderLayer } from './BaseRenderLayer';
export class LinkRenderLayer extends BaseRenderLayer {
private _state: ILinkifierEvent | undefined;
@@ -7,7 +7,7 @@ import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { BaseRenderLayer } from './BaseRenderLayer';
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { Terminal } from 'xterm';
import { Terminal } from '@xterm/xterm';
interface ISelectionState {
start?: [number, number];
@@ -4,18 +4,16 @@
*/
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { CharData, ICellData } from 'common/Types';
import { GridCache } from './GridCache';
import { BaseRenderLayer } from './BaseRenderLayer';
import { AttributeData } from 'common/buffer/AttributeData';
import { NULL_CELL_CODE, Content, UnderlineStyle } from 'common/buffer/Constants';
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
import { CellData } from 'common/buffer/CellData';
import { IOptionsService, IBufferService, IDecorationService } from 'common/services/Services';
import { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { JoinedCellData } from 'browser/services/CharacterJoinerService';
import { color, css } from 'common/Color';
import { Terminal } from 'xterm';
import { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { CharData, ICellData } from 'common/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { CellData } from 'common/buffer/CellData';
import { Content, NULL_CELL_CODE } from 'common/buffer/Constants';
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
import { BaseRenderLayer } from './BaseRenderLayer';
import { GridCache } from './GridCache';
/**
* This CharData looks like a null character, which will forc a clear and render
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"target": "es2021",
"lib": [
"dom",
"es6"
"es2021"
],
"rootDir": ".",
"outDir": "../out",
@@ -17,6 +17,9 @@
],
"browser/*": [
"../../../src/browser/*"
],
"@xterm/addon-canvas": [
"../typings/addon-canvas.d.ts"
]
},
"strict": true,
@@ -0,0 +1,37 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
import test from '@playwright/test';
import { ISharedRendererTestContext, injectSharedRendererTests, injectSharedRendererTestsStandalone } from '../../../out-test/playwright/SharedRendererTests';
import { ITestContext, createTestContext, openTerminal } from '../../../out-test/playwright/TestUtils';
let ctx: ITestContext;
const ctxWrapper: ISharedRendererTestContext = {
value: undefined,
skipCanvasExceptions: true
} as any;
test.beforeAll(async ({ browser }) => {
ctx = await createTestContext(browser);
await openTerminal(ctx);
ctxWrapper.value = ctx;
await ctx.page.evaluate(`
window.addon = new window.CanvasAddon(true);
window.term.loadAddon(window.addon);
`);
});
test.afterAll(async () => await ctx.page.close());
test.describe('Canvas Renderer Integration Tests', () => {
// HACK: The tests fail for an unknown reason
test.skip(({ browserName }) => browserName === 'webkit');
injectSharedRendererTests(ctxWrapper);
injectSharedRendererTestsStandalone(ctxWrapper, async () => {
await ctx.page.evaluate(`
window.addon = new window.CanvasAddon(true);
window.term.loadAddon(window.addon);
`);
});
});
@@ -0,0 +1,35 @@
import { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
testDir: '.',
timeout: 10000,
projects: [
{
name: 'Chrome Stable',
use: {
browserName: 'chromium',
channel: 'chrome'
}
},
{
name: 'Firefox Stable',
use: {
browserName: 'firefox'
}
},
{
name: 'WebKit',
use: {
browserName: 'webkit'
}
}
],
reporter: 'list',
webServer: {
command: 'npm run start-server-only',
port: 3000,
timeout: 120000,
reuseExistingServer: !process.env.CI
}
};
export default config;
@@ -20,9 +20,10 @@
},
"strict": true,
"types": [
"../../../node_modules/@types/mocha",
"../../../node_modules/@types/node",
"../../../out-test/api/TestUtils"
"../../../node_modules/@lunapaint/png-codec",
"../../../out-test/playwright/TestUtils",
"../../../out-test/playwright/SharedRendererTests"
]
},
"include": [
@@ -3,9 +3,9 @@
* @license MIT
*/
import { Terminal, ITerminalAddon, IEvent } from 'xterm';
import { Terminal, ITerminalAddon, IEvent } from '@xterm/xterm';
declare module 'xterm-addon-canvas' {
declare module '@xterm/addon-canvas' {
/**
* An xterm.js addon that provides search functionality.
*/
@@ -6,7 +6,7 @@
const path = require('path');
const addonName = 'CanvasAddon';
const mainFile = 'xterm-addon-canvas.js';
const mainFile = 'addon-canvas.js';
module.exports = {
entry: `./out/${addonName}.js`,
@@ -1,18 +1,18 @@
## xterm-addon-fit
## @xterm/addon-fit
An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables fitting the terminal's dimensions to a containing element. This addon requires xterm.js v4+.
### Install
```bash
npm install --save xterm-addon-fit
npm install --save @xterm/addon-fit
```
### Usage
```ts
import { Terminal } from 'xterm';
import { FitAddon } from 'xterm-addon-fit';
import { Terminal } from '@xterm/xterm';
import { FitAddon } from '@xterm/addon-fit';
const terminal = new Terminal();
const fitAddon = new FitAddon();
@@ -21,4 +21,4 @@ terminal.open(containerElement);
fitAddon.fit();
```
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/xterm-addon-fit/typings/xterm-addon-fit.d.ts) for more advanced usage.
See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-fit/typings/addon-fit.d.ts) for more advanced usage.
@@ -1,13 +1,13 @@
{
"name": "xterm-addon-attach",
"version": "0.8.0",
"name": "@xterm/addon-fit",
"version": "0.9.0",
"author": {
"name": "The xterm.js authors",
"url": "https://xtermjs.org/"
},
"main": "lib/xterm-addon-attach.js",
"types": "typings/xterm-addon-attach.d.ts",
"repository": "https://github.com/xtermjs/xterm.js",
"main": "lib/addon-fit.js",
"types": "typings/addon-fit.d.ts",
"repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-fit",
"license": "MIT",
"keywords": [
"terminal",
@@ -21,6 +21,6 @@
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"xterm": "^5.0.0"
"@xterm/xterm": "^5.0.0"
}
}
@@ -3,7 +3,8 @@
* @license MIT
*/
import { Terminal, ITerminalAddon } from 'xterm';
import type { Terminal, ITerminalAddon } from '@xterm/xterm';
import type { FitAddon as IFitApi } from '@xterm/addon-fit';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
interface ITerminalDimensions {
@@ -21,11 +22,9 @@ interface ITerminalDimensions {
const MINIMUM_COLS = 2;
const MINIMUM_ROWS = 1;
export class FitAddon implements ITerminalAddon {
export class FitAddon implements ITerminalAddon , IFitApi {
private _terminal: Terminal | undefined;
constructor() {}
public activate(terminal: Terminal): void {
this._terminal = terminal;
}
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"target": "es2021",
"lib": [
"dom",
"es2015"
@@ -17,6 +17,9 @@
"paths": {
"browser/*": [
"../../../src/browser/*"
],
"@xterm/addon-fit": [
"../typings/addon-fit.d.ts"
]
}
},
@@ -4,8 +4,8 @@
*/
import { assert } from 'chai';
import { openTerminal, launchBrowser } from '../../../out-test/api/TestUtils';
import { Browser, Page } from 'playwright';
import { openTerminal, launchBrowser, timeout } from '../../../out-test/api/TestUtils';
import { Browser, Page } from '@playwright/test';
const APP = 'http://127.0.0.1:3001/test';
@@ -41,9 +41,7 @@ describe('FitAddon', () => {
});
describe('proposeDimensions', () => {
afterEach(async () => {
return await unloadFit();
});
afterEach(() => unloadFit());
it('default', async function(): Promise<any> {
await loadFit();
@@ -77,14 +75,20 @@ describe('FitAddon', () => {
await page.evaluate(`window.term = new Terminal()`);
await page.evaluate(`window.term.open(document.querySelector('#terminal-container'))`);
await loadFit();
assert.equal(await page.evaluate(`window.fit.proposeDimensions()`), undefined);
const dimensions: { cols: number, rows: number } | undefined = await page.evaluate(`window.fit.proposeDimensions()`);
// The value of dims will be undefined if the char measure strategy falls back to the DOM
// method, so only assert if it's not undefined.
if (dimensions) {
assert.isAbove(dimensions.cols, 85);
assert.isBelow(dimensions.cols, 88);
assert.isAbove(dimensions.rows, 24);
assert.isBelow(dimensions.rows, 29);
}
});
});
describe('fit', () => {
afterEach(async () => {
return await unloadFit();
});
afterEach(() => unloadFit());
it('default', async function(): Promise<any> {
await loadFit();
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"target": "es2021",
"lib": [
"es2015"
],
@@ -3,9 +3,9 @@
* @license MIT
*/
import { Terminal, ITerminalAddon } from 'xterm';
import { Terminal, ITerminalAddon } from '@xterm/xterm';
declare module 'xterm-addon-fit' {
declare module '@xterm/addon-fit' {
/**
* An xterm.js addon that enables resizing the terminal to the dimensions of
* its containing element.
@@ -6,7 +6,7 @@
const path = require('path');
const addonName = 'FitAddon';
const mainFile = 'xterm-addon-fit.js';
const mainFile = 'addon-fit.js';
module.exports = {
entry: `./out/${addonName}.js`,
+34
View File
@@ -0,0 +1,34 @@
node_modules/
*.swp
.lock-wscript
lib/
out/
out-test/
out-worker/
.nyc_output/
Makefile.gyp
*.Makefile
*.target.gyp.mk
*.node
example/*.log
docs/
npm-debug.log
/.idea/
.env
build/
.DS_Store
package-lock.json
yarn.lock
# Keep bundled code out of Git
dist/
demo/dist/
# skip benchmark & inwasm folders, except builds
.benchmark/
timeline/
inwasm-sdks/
inwasm-builds/
!inwasm-builds/**/final.wat
!inwasm-builds/**/final.wasm
!inwasm-builds/**/definition.json
+10
View File
@@ -0,0 +1,10 @@
.github
fixture
overwrite
bootstrap.sh
tsconfig.json
webpack.config.js
test
out-test
inwasm-sdks
inwasm-builds
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2019, 2020, 2021, 2022, 2023 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.
+231
View File
@@ -0,0 +1,231 @@
## @xterm/addon-image
Inline image output in xterm.js. Supports SIXEL and iTerm's inline image protocol (IIP).
![](fixture/example.png)
### Install from npm
```bash
npm install --save @xterm/addon-image
```
### Usage
```ts
import { Terminal } from '@xterm/xterm';
import { ImageAddon, IImageAddonOptions } from '@xterm/addon-image';
// customize as needed (showing addon defaults)
const customSettings: IImageAddonOptions = {
enableSizeReports: true, // whether to enable CSI t reports (see below)
pixelLimit: 16777216, // max. pixel size of a single image
sixelSupport: true, // enable sixel support
sixelScrolling: true, // whether to scroll on image output
sixelPaletteLimit: 256, // initial sixel palette size
sixelSizeLimit: 25000000, // size limit of a single sixel sequence
storageLimit: 128, // FIFO storage limit in MB
showPlaceholder: true, // whether to show a placeholder for evicted images
iipSupport: true, // enable iTerm IIP support
iipSizeLimit: 20000000 // size limit of a single IIP sequence
}
// initialization
const terminal = new Terminal();
const imageAddon = new ImageAddon(customSettings);
terminal.loadAddon(imageAddon);
```
### General Notes
- *IMPORTANT:* The worker approach as done in previous releases got removed.
The addon contructor no longer expects a worker path as first argument.
- By default the addon will activate these `windowOptions` reports on the terminal:
- getWinSizePixels (CSI 14 t)
- getCellSizePixels (CSI 16 t)
- getWinSizeChars (CSI 18 t)
to help applications getting useful terminal metrics for their image preparations. Set `enableSizeReports` in the constructor options to `false`, if you dont want the addon to alter these terminal settings. This is especially useful, if you have very strict security needs not allowing any terminal reports, or deal with `windowOptions` by other means.
### Operation Modes
- **SIXEL Support**
Set by default, change it with `{sixelSupport: true}`.
- **Scrolling On | Off**
By default scrolling is on, thus an image will advance the cursor at the bottom if needed.
(see cursor positioning).
If scrolling is off, the image gets painted from the top left of the current viewport
and might be truncated if the image exceeds the viewport size.
The cursor position does not change.
You can customize this behavior with the constructor option `{sixelScrolling: false}`
or with `DECSET 80` (off, binary: `\x1b [ ? 80 h`) and
`DECRST 80` (on, binary: `\x1b [ ? 80 l`) during runtime.
- **Cursor Positioning**
If scrolling is set, the cursor will be placed at the first image column of the last image row (VT340 mode).
Other cursor positioning modes as used by xterm or mintty are not supported.
- **SIXEL Palette Handling**
By default the addon limits the palette size to 256 registers (as demanded by the DEC specification).
The limit can be increased to a maximum of 4096 registers (via `sixelPaletteLimit`).
The default palette is a mixture of VT340 colors (lower 16 registers), xterm colors (up to 256) and zeros (up to 4096).
There is no private/shared palette distinction, palette colors are always carried over from a previous sixel image.
Restoring the default palette size and colors is possible with `XTSMGRAPHICS 1 ; 2` (binary: `\x1b[?1;2S`).
It gets also restored automatically on RIS and DECSTR.
Other than on older terminals, the underlying SIXEL library applies colors immediately to individual pixels
(*printer mode*), thus it is technically possible to use more colors in one image than the palette has color slots.
This feature is called *high-color* in libsixel.
A terminal wide shared palette mode with late indexed coloring of the output is not supported,
therefore palette animations cannot be used.
- **SIXEL Raster Attributes Handling**
If raster attributes were found in the SIXEL data (level 2), the image will always be truncated to the given height/width extend. We deviate here from the specification on purpose, as it allows several processing optimizations. For level 1 SIXEL data without any raster attributes the image can freely grow in width and height up to the last data byte, which has a much higher processing penalty. In general encoding libraries should not create level 1 data anymore and should not produce pixel information beyond the announced height/width extend. Both is discouraged by the >30 years old specification.
Currently the SIXEL implementation of the addon does not take custom pixel sizes into account, a SIXEL pixel will map 1:1 to a screen pixel.
- **IIP Support (iTerm's Inline Image Protocol)**
Set by default, change it with `{iipSupport: true}`.
The IIP implementation has the following features / restrictions (sequence will silently fail for unmet conditions):
- Supported formats: PNG, JPEG and GIF
- No animation support.
- Image type hinting is not supported (always deducted from data header).
- File download is not supported.
- Filename gets parsed but not used.
- Strict base64 handling as of RFC4648 §4 (standard alphabet, optional padding, no separator bytes allowed).
- Payload size may not exceed CEIL(sizeParameter * 4 / 3).
- Image scaling beyond terminal viewport size is allowed (e.g. `width=200%`).
- Image pixel size is restricted by `pixelLimit` (pre- and post resizing).
- Size parameter is restricted by `iipSizeLimit`.
- Cursor positioning behaves the same as for sixel (see above).
### Storage and Drawing Settings
The internal storage holds images up to `storageLimit` (in MB, calculated as 4-channel RBGA unpacked, default 100 MB). Once hit images get evicted by FIFO rules. Furthermore images on the alternate buffer will always be erased on buffer changes.
The addon exposes two properties to interact with the storage limits at runtime:
- `storageLimit`
Change the value to your needs at runtime. This is especially useful, if you have multiple terminal
instances running, that all add to one upper memory limit.
- `storageUsage`
Inspect the current memory usage of the image storage.
By default the addon will show a placeholder pattern for evicted images that are still part
of the terminal (e.g. in the scrollback). The pattern can be deactivated by toggling `showPlaceholder`.
### Image Data Retrieval
The addon provides the following API endpoints to retrieve raw image data as canvas:
- `getImageAtBufferCell(x: number, y: number): HTMLCanvasElement | undefined`
Returns the canvas containing the original image data (not resized) at the given buffer position.
The buffer position is the 0-based absolute index (including scrollback at top).
- `extractTileAtBufferCell(x: number, y: number): HTMLCanvasElement | undefined`
Returns a canvas containing the actual single tile image data (maybe resized) at the given buffer position.
The buffer position is the 0-based absolute index (including scrollback at top).
Note that the canvas gets created and data copied over for every call, thus it is not suitable for performance critical actions.
### Memory Usage
The addon does most image processing in Javascript and therefore can occupy a rather big amount of memory. To get an idea where the memory gets eaten, lets look at the data flow and processing steps:
- Incomming image data chunk at `term.write` (terminal)
`term.write` might stock up incoming chunks. To circumvent this, you will need proper flow control (see xterm.js docs). Note that with image output it is more likely to run into this issue, as it can create lots of MBs in very short time.
- Sequence Parser (terminal)
The parser operates on a buffer containing up to 2^17 codepoints (~0.5 MB).
- Sequence Handler - Chunk Decoding (addon)
Image data chunks are processed immediately by the SIXEL decoder (streamlined). The decoder allocates memory for image
pixels as needed. The allowed image size is restricted by `pixelLimit` (default 16M pixels), the decoder holds 2 pixel buffers at maximum during decoding (RGBA, ~128 MB for 16M pixels).
- Sequence Handler - Image Finalization (addon)
After decoding the final pixel buffer is grabbed by the sequence handler and written to a canvas of the same size (~64 MB for 16M pixels) and added to the storage.
- Image Storage (addon)
The image storage implements a FIFO cache, that will remove old images, if a new one arrives and `storageLimit` is hit (default 128 MB). The storage holds a canvas with the original image, and may additionally hold resized versions of images after a font rescaling. Both are accounted in `storageUsage` as a rough estimation of _pixels x 4 channels_.
Following the steps above, a rough estimation of maximum memory usage by the addon can be calculated with these formulas (in bytes):
```typescript
// storage alone
const storageBytes = storageUsage * storageLimit * 1024 * 1024;
// decoding alone
const decodingBytes = sixelSizeLimit + 2 * (pixelLimit * 4);
// totals
// inactive decoding
const totalInactive = storageBytes;
// active decoding
const totalActive = storageBytes + decodingBytes;
```
Note that browsers have offloading tricks for rarely touched memory segments, esp. `storageBytes` might not directly translate into real memory usage. Usage peaks will happen during active decoding of multiple big images due to the need of 2 full pixel buffers at the same time, which cannot be offloaded. Thus you may want to keep an eye on `pixelLimit` under limited memory conditions.
Further note that the formulas above do not respect the Javascript object's overhead. Compared to the raw buffer needs the book keeping by these objects is rather small (<<5%).
_Why should I care about memory usage at all?_
Well you don't have to, and it probably will just work fine with the addon defaults. But for bigger integrations, where much more data is held in the Javascript context (like multiple terminals on one page), it is likely to hit the engine's memory limit sooner or later under decoding and/or storage pressure.
_How can I adjust the memory usage?_
- `pixelLimit`
A constructor setting, thus you would have to anticipate, whether (multiple) terminals in your page gonna do lots of concurrent decoding. Since this is normally not the case and the memory usage is only temporarily peaking, a rather high value should work even with multiple terminals in one page.
- `storageLimit`
A constructor and a runtime setting. In conjunction with `storageUsage` you can do runtime checks and adjust the limit to your needs. If you have to lower the limit below the current usage, images will be removed in FIFO order and may turn into a placeholder in the terminal's scrollback (if `showPlaceholder` is set). When adjusting keep in mind to leave enough room for memory peaking for decoding.
- `sixelSizeLimit`
A constructor setting. This has only a small impact on peaking memory during decoding. It is meant to avoid processing of overly big or broken SIXEL sequences at an earlier phase, thus may stop the decoder from entering its memory intensive task for potentially invalid data.
### Terminal Interaction
- Images already on the terminal screen will reshape on font-rescaling to keep the terminal cell coverage intact.
This behavior might diverge from other terminals, but is in general the more desired one.
- On terminal resize images may expand to the right automatically, if they were right-truncated before.
They never expand to the bottom, if they were bottom-truncated before (e.g. from scrolling-off).
- Text autowrapping from terminal resize may break and wrap images into multiple parts. This is unfortunate,
but cannot be avoided, while sticking to the stronger terminal text-grid mechanics.
(Yes images are a second class citizen on a mainly text-driven interface.)
- Characters written over an image will erase the image information for affected cells.
- Images are painted above BG/FG data not erasing it. More advanced "composition tricks" like painting images
below FG/BG data are not possible. (We currently dont hook into BG/FG rendering itself.)
- Previous image data at a cell will be erased on new image data. (We currently have no transparency composition.)
### Performance & Latency
- Performance should be good enough for occasional SIXEL output from REPLs, up to downscaled movies
from `mpv` with its SIXEL renderer (tested in the demo). For 3rd party xterm.js integrations this
furthermore depends highly on the overall incoming data throughput.
- Image processing has a high latency. Most of the latency though is inherited from xterm.js' incoming data route
(PTY -> server process -> websocket -> xterm.js async parsing), where every step creates more waiting time.
Since we cannot do much about that "long line", keep that in mind when you try to run more demanding applications with realtime drawing and interactive response needs.
### Status
- Sixel support and image handling in xterm.js is considered beta quality.
- IIP support is in alpha stage. Please file a bug for any awkwardities.
### Changelog
- 0.5.0 integrate with xtermjs base repo (at v0.4.3)
- 0.4.3 defer canvas creation
- 0.4.2 fix image canvas resize
- 0.4.1 compat release for xterm.js 5.2.0
- 0.4.0 IIP support
- 0.3.1 compat release for xterm.js 5.1.0
- 0.3.0 important change: worker removed from addon
- 0.2.0 compat release for xterm.js 5.0.0
- 0.1.3 bugfix: avoid striping
- 0.1.2 bugfix: reset clear flag
- 0.1.1 bugfixes:
- clear sticky image tiles on render
- create folder from bootstrap.sh
- fix peer dependency in package.json
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
# sixel endless mode
# Should print an endless sine curve, abort with Ctrl-C.
period=200
amplitude=50
sixels=(@\$ A\$ C\$ G\$ O\$ _\$-)
pi=$(echo "scale=10; 4*a(1)" | bc -l)
run=true
trap run=false INT
echo -ne "\x1bP0;0;0q\"1;1#1;2;100;0;0#1"
y=0
while $run
do
x=$(echo "s(2*${pi}*${y}/${period})*${amplitude}+2*${amplitude}+0.5" | bc -l)
echo -ne "!${x%%.*}?${sixels[$((y%6))]}"
(( y++ ))
done
echo -e "\x1b\\"
Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
# GLF should move the text cursor downwards,
# even if no pixels were modified,
# when sixel scrolling is on.
echo -n $'\e[?80l' # Ensure sixel scrolling is on (disable DECSDM)
clear
echo "A test of Sixel GLF (Graphics Line Feed) when sixel scrolling is on"
echo
# Move cursor down three using GLF ("-")
echo -e '\x1bPq$-$-$-$-\x1b\\'
# Show a single sixel line that says, "Your terminal ->"
cat <<'EOF'
P0;0;0q"1;1;244;21#0;2;0;0;0#1;2;80;80;80#0~~~NFFFN~~~n!4FN!68~NFN!64~bbb!42~rbbbBB!41~$#1???owwwo???O!4wo!68?owo!64?[[[!42?K[[[{{-#0!5~{woBFB`o{}!4~NFBpp!4xpbBF~~~x@@@~~~xxp@@!5~xxp@@b`pxwxpz!17~zpp???!5px!5~NFBpxxwxxpBBN!4~xxp@@b`pxwxpz~x@@@xxp@@pxx@@F!4~xppp@@!8~x@@@pxxwxp@B!5~zxXXXWXX@BF!10~??!24~!10^FNN^~~~$#1!5?BFN{w{]NB@!4?ow{MM!4EM[{w???E}}}???EEM}}!5?EEM}}[]MEFEMC!17?CMM~~~!5ME!5?ow{MEEFEEM{{o!4?EEM}}[]MEFEMC?E}}}EEM}}MEE}}w!4?EMMM}}!8?E}}}MEEFEM}{!5?CEeeefee}{w!10?~~!24?!10_woo_-#0!5~nFFF??FFN!5~wo_FF!4NFb_o!4~{o_!4Ffb??Fn~~~NFF??!4FN!23~_??!5NFFn~~~w__C!7KCC!4~NFF??!4FN!4~N???N~~??Fn~???N~~N!4F??!4Fn~~~F???Fn~~nF??Fn~~p??KMMMEE???Fn~~~N!4F??!4Fn!29~{{}!4~$#1!5?Owww~~wwo!5?FN^ww!4ow[^N!4?BN^!4wW[~~wO???oww~~!4wo!23?^~~!5owwO???F^^z!7rzz!4?oww~~!4wo!4?o~~~o??~~wO?~~~o??o!4w~~!4wO???w~~~wO??Ow~~wO??M~~rpppxx~~~wO???o!4w~~!4wO!29?BB@-#0!25FE!63FE!15FE!77FE!60F$#1!25?@!63?@!15?@!77?@-\
EOF
sleep 1
tput cup 2 30
# Show four lines saying, "<- A genuine VT340 would end here"
cat <<'EOF'
P0;0;0q"1;1;144;80#0;2;0;0;0#1;2;80;80;80#0~~rpp@@`@BN!25~!11^!5~^^^N^^^!6~!7^N^^^!5~!4^~~~!5^!6~^^^WWW!8~!7^N^^^!8~^^^N^^^!5~$#1??KMM}}]}{o!25?!11_!5?___o___!6?!7_o___!5?!4_???!5_!6?___fff!8?!7_o___!8?___o___-#0~~NB??EFE??@F^!19~B??{!4}{W??}}~~B@?K!5MK??B~~~}???{!4}{??!4~}???~~~}}{??!6~}{{{??!8~}???{!4}{??!4~B@?K!5MK??B~~$#1??o{~~xwx~~}w_!19?{~~B!4@Bf~~@@??{}~r!5pr~~{???@~~~B!4@B~~!4?@~~~???@@B~~!6?@BBB~~!8?@~~~B!4@B~~!4?{}~r!5pr~~{-#0rpoopr~~~zpooopr!17~}{ww!4pwW??!4~}wwprrb!4rpp~~~pooopz~~zpoopz!4~{w!4pxwoopz~~~r!4poo!4pz~~~pooopz~~zpoopz~~}wwprrb!4rpp~~$#1KMNNMK???CMNNNMK!17?@BFF!4MFf~~!4?@FFMKK[!4KMM???MNNNMC??CMNNMC!4?BF!4MEFNNMC???K!4MNN!4MC???MNNNMC??CMNNMC??@FFMKK[!4KMM-#0!32~^NNNKWwww[[MNNN^~!13N!5~NN!5FNN^!10~N!4F!8~NN!4FN^!36~$#1!32?_ooorfFFFbbpooo_?!13o!5?oo!5woo_!10?o!4w!8?oo!4wo_-#0!32~}{o?AM!4~E?_w}}~o_o}}???}}}__!5~}}~fFFFAOw!6~^FB_w{???!6~B??}!4~{??!35~$#1!32?@BN~|p!4?x~^F@@?N^N@@~~~@@@^^!5?@@?Wwww|nF!6?_w{^FB~~~!6?{~~@!4?B~~-#0!36~{_?FB?o}!7~^NN???NN^!6~!8NE?_x!4~poooP@@???X!5~{o?F!4NB_o!35~$#1!36?B^~w{~N@!7?_oo~~~oo_!6?!8ox~^E!4?MNNNm}}~~~e!5?BN~w!4o{^N-#0!38~}}}!11~!8}!8~!6}!13~!6}!9~!4}!38~$#1!38?@@@!11?!8@!8?!6@!13?!6@!9?!4@-#0!5^!5~!5^!5~!7^!6~!4^~~~!5^!6~{www??!11~^^^N^\W???!22~^^^N^^^!6~!7^N^^^!8~^^^N^\W???~~$#1!5_!5?!5_!5?!7_!6?!4_???!5_!6?BFFF~~!11?___o_af~~~!22?___o___!6?!7_o___!8?___o_af~~~-#0}{??CMB@@FM??o{~~B@?{{!4}{w?@~~~}???~~~}}{??!10~??!8~B??{!5}{???!19~B@?K!5MK??B~~~}???{!4}{??!4~B??{!5}{???~~$#1@B~~zp{}}wp~~NB??{}~BB!4@BF~}???@~~~???@@B~~!10?~~!8?{~~B!5@B~~~!19?{}~r!5pr~~{???@~~~B!4@B~~!4?{~~B!5@B~~~-#0~~~woow~}woo{!4~}{wpprbrrpww{!5~{w!4pxwoopz~~~r!4poo!4pz~~~}{ww!5pwooopz!17~}wwprrb!4rpp~~~pooopz~~zpoopz~~}{ww!5pwooopz$#1???FNNF?@FNNB!4?@BFMMK[KKMFFB!5?BF!4MEFNNMC???K!4MNN!4MC???@BFF!5MFNNNMC!17?@FFMKK[!4KMM???MNNNMC??CMNNMC??@BFF!5MFNNNMC-#0!40~n!4F!99~$#1!40?O!4w-#0!10~^^n!29~???b!4rbBF!4~^NFbrrprrbFF^!4~rrbBBFBbrrrbv~~^NFbrrprrbFF^!42~$#1!10?__O!29?~~~[!4K[{w!4?_ow[KKMKK[ww_!4?KK[{{w{[KKK[G??_ow[KKMKK[ww_-#0!9~}{wq!10}!18~N???N^~~^N??N^~~o??H!6XWGG!4~^NN??!4N^!5~o??H!6XWGG!42~$#1!9?@BFL!10@!18?o~~~o_??_o~~o_??N~~u!6efvv!4?_oo~~!4o_!5?N~~u!6efvv-#0!41B!6ABB!6A!5BAAA?!6A!4B!10A!8BAAA?!6A!42B$#1!41?!6@??!6@!5?@@@B!6@!4?!10@!8?@@@B!6@$-\This text should be indented.
EOF
# For more details, please see:
# https://github.com/jerch/xterm-addon-image/issues/37
# By default, sixel is in a 2:1 aspect ratio, which means
# every sixel graphics linefeed (GLF) adds another 12 pixels.
# With four GLFs, we have five sixel lines = 5 * 12 = 60 pixels.
# Which text line that ends up on depends upon the height of your
# font. On the VT340, the font is 20 pixels high.
# On a VT340 sixel scrolling is on by default. DEC refers to this by
# two different names "sixel scrolling" and its negation, "DECSDM"
# (Sixel Display Mode). They control the same thing, so when DECSDM is
# on, sixel scrolling is off, and vice versa.
# When DECSDM is on, the graphic line feeds do not affect the text cursor.
# How hackerb9 created the two sixel test images:
#
# convert -family "Courier" -style normal -density 72 -pointsize 26 -interline-spacing -12 -gravity center -fill gray80 -background none label:$'A genuine\nVT340\nwould end\n← here ' +trim +dither -colors 2 sixel:- > reference.six
#
# convert -family "Courier" -style normal -density 72 -pointsize 26 -interline-spacing -12 -gravity center -fill gray80 -background none label:$'Your terminal →' +trim -bordercolor none -border 2 +dither -colors 2 sixel:- > yourterminal.six
@@ -0,0 +1,44 @@
const sixelEncode = require('../node_modules/sixel/lib/SixelEncoder').image2sixel;
const toRGBA8888 = require('../node_modules/sixel/lib/Colors').toRGBA8888;
function createRect(size, color) {
const pixels = new Uint32Array(size * size);
pixels.fill(toRGBA8888(...color));
return sixelEncode(new Uint8ClampedArray(pixels.buffer), size, size);
}
function createRectMinusOne(size, color) {
const pixels = new Uint32Array(size * size);
if (size - 1) {
const sub = new Uint32Array(size - 1);
sub.fill(toRGBA8888(...color));
const last = size * (size - 1);
for (let y = 0; y < last; y += size) {
pixels.set(sub, y);
}
}
return sixelEncode(new Uint8ClampedArray(pixels.buffer), size, size);
}
async function main() {
// clear + cursor and sixelScrolling off
process.stdout.write('\x1b[2J\x1b[?25;80h');
for (let i = 1; i < 300; ++i) {
await new Promise(res => setTimeout(() => {
process.stdout.write(createRect(i, [0, 255, 0]));
res();
}, 5));
}
for (let i = 299; i >= 1; --i) {
await new Promise(res => setTimeout(() => {
process.stdout.write(createRectMinusOne(i, [0, 255, 0]));
res();
}, 5));
}
// re-enable cursor and sixel scrolling
process.stdout.write('\x1b[2J\x1b[?25;80l');
}
main();
@@ -0,0 +1 @@
]1337;File=inline=1;size=525;name=Li4vcGFsZXR0ZS5wbmc=:iVBORw0KGgoAAAANSUhEUgAAAoAAAABQCAYAAACJbMQlAAAABmJLR0QA/wD/AP+gvaeTAAABwklEQVR4nO3dwQnEMAwAQedIIem/yVwLBj0C3pm3uAO/Fj2ia631rh3P1lRu7vnof0+Z836zOe83m/N+sznvN5vzfrM57zeb+23+HAAAhxCAAAAxAhAAIEYAAgDECEAAgBgBCAAQIwABAGIEIABAjAAEAIi59z8tDQDACWwAAQBiBCAAQIwABACIEYAAADECEAAgRgACAMQIQACAGAEIABAjAAEAYlwCAQCIsQEEAIgRgAAAMQIQACBGAAIAxAhAAIAYAQgAECMAAQBiBCAAQIwABACIcQkEACDGBhAAIEYAAgDECEAAgBgBCAAQIwABAGIEIABAjAAEAIgRgAAAMQIQACDGJRAAgBgbQACAGAEIABAjAAEAYgQgAECMAAQAiBGAAAAxAhAAIEYAAgDECEAAgBiXQAAAYmwAAQBiBCAAQIwABACIEYAAADECEAAgRgACAMQIQACAGAEIABAjAAEAYlwCAQCIsQEEAIgRgAAAMQIQACBGAAIAxAhAAIAYAQgAECMAAQBiBCAAQIwABACIcQkEACDGBhAAIEYAAgDECEAAgBgBCAAQIwABAGIEIABAjAAEAIgRgAAAMQIQACDmDz4lC02AaqMRAAAAAElFTkSuQmCC
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
]1337;File=inline=1;size=1667;name=Li4vdGVzdGltYWdlcy93M2NfaG9tZV8yNTYuZ2lm:R0lGODlhSAAwAPcAAAQCBIyKjMzOzERGRHSOvAxCnLy6vNzm9DRmrCQiJGxubNze3HSWxJSq1JyenCRarPz+/FR+vBweHLzG5FxeXGSKxBROpOzu7ERytDw+PHx+fLTC5AwODIyOjExOTAxGnLy+vDxqtCwuLHR2dNTa7ISezKS23KyurMTO5GyKxOzy/ACCXwAAN7AAF+IAjIEAw8DPArtsAOSupIHW2HBvAsUBAHIAbwAAARwAiEdgA/caAr+CAgCIALAjAOMcJIGCAAB8EADGAAByiAAArcQcSrtHBOT3zYG/AaQA7sVgE3Ib9wCCv88AZ2wAAaIAANUAAG+M4wEjogAc9wCCv8SwGbvGBeRyAIEAAF/PrBZsxwCucgDWAIRvpMUBaHIAAQAAAFCMfEIjj/kcUb+CAAC4sLAZKOL3AIG/AECQoAfGowBy9wAAvwBQAABCAAD5UAC/ALgALBlguPcaUb+CAMRwpNUFaAAAAQAAAOAAAPgAAHIAAAAAAG24DBgZAPf3UL+/AM/QAGzWAKIAUNUAAADgfAD4jwByUQAAAKJtQNUYAH/3AFe/AGTPABNsAACuAADWAAAAMgAABUYAAAIAAACuGQDWBQh/AABXAAJH1AABx8QAcgsAAAMAUAAApTdG9wYCv3oAADMAAKUBULAAAEcCZwEApQCM9wDDv0ACAAcAAABfUAAWAKUAQ7AAAEelAAGwAPhHQ8UBAHIAAAAAABhwFIkFxX8AUIEAABClAtKwADxHAIIBABAUopPXKKZm99Iov/gf+MUXx3IAcgAAAAxwZsYFtHIA9wAAvxgAAIlgAH8aUIGCAHiM1QrDtD0C94IAvxAAAJMASqYChdIAgQxw78YFGXIA+AAAvw4AM6EAGvcA+L8AvyYAALMASveNhb+tgQBKLGAEuDzNUYIBAADRmwABbgAA9wAAv8+kFmzYxWYCUNYAAG+k4wHYKAACQgAAAAAAHmAAxTsoUIIAADwcvcZ6bnIC9wAAvxgAm4kAbn8A94EAv0QABAoAAD0MAIIXACH5BAAAAAAALAAAAABIADAABwj/AAEIHEiwoMGDCBMqXGgQgsOHECNKnEixosWLGDNq3Mixo8ePIEOKHCkxgMkRBkiq7BhAgEmXAlbKxBgAwoALAyDUnMlzYs0EA1LuVIGiKAoVEg8YRXFxQoOnJpZKLYpUY0wII2wKGLBg54EPYD+YkEgi7AemFS2AVRuW7Qe3aB8K8ACAA4UFDy+IcGhg54URFx4+CFthIlsLDCqiKGD2bWOzcSE4MOjAoQYAck0GCPyQweGJFcI+qMiA8eO2azFAFIDQwAUOAEBcRNGWhEQTZg9QRFDg8NrTkSUglKBAYOWLbhNHVGG2wcSvYVNE3GC28MPJA0VoUJCAIAfOFiOE/0UwEYPjCBMbmK0quC17CBkGHodwgcJADRlxO9YdMXTY9w6Jx1gIEZXg2AclQHSBfBLZ911GzIU1VkRufTCBRL8595AKbo0G0QkCUUCRdhuFEBZ6EJFQoXUPTWCWbQ/5B9aFEF0GAF4TCQAeRuqFVeBvH3gYo2gQ0eaYahHR5cFKZTm2AUQIPAajQ4OBpZxD5oXFH0TxzUdSlR9c+VWFFiToUJNgPemQfmCxyCUAO44ko5BsukWeQz1aYMGGg7kVwpQOZSDBTC46BqN4bxn4n0MmgoUiBD2iJhaXGfDUnENuHSCeWmNFCNaEEJRQoVmgalDpTIh+oBp1YJEXKXpsfv+wJQol1IqAbxZU5cCpMuHGlgoMrJUYdG9BEJpaBFKEQoVmLsDrSsSKBSaMYC4blpkUoVmsZT1FCVaj20Lg2bcvXnQsWDDKxtO4jbFoZGNCVsTqWxr2BEGTvtGIqaRuZmsWtvaO+sF7Moalr0VuAdxTwR88uuaBYAH43G8pqItRnBkVGla9DnmqlsOK/btkRhnguFGEbG35UJZg1TtBBHdGFCxbKHSA30UBAHCCRywnG1GksjrkrYXLgTnwAgB4KZEAsN3MUaRXQkSszzJaAGiwJzpUnNJywZa0R9BZEBlED6glpltlokDCuW+h9RoAO0EUgNd7fdQnaWBFpqjAWT9gBCIAxJ1wggLCCcSByR0F22+R4a7cWIUIAIjdQRxc9RFtoBq2uAopnPZBCBJL5jVBElgOUq4WVZB5kZt+u3pECygggkAZdICxvbjnrvvuvPfu++/ABy88Q8QXb/zxAgUEADs=
@@ -0,0 +1 @@
]1337;File=inline=1;size=2159;name=Li4vdGVzdGltYWdlcy93M2NfaG9tZV8yNTYuanBn:/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAwAEgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD33/hXPgn/AKE7w3/4K4P/AImj/hXPgn/oTvDf/grg/wDia8y/aLuNX0PWtB1nS7+8ghcGJ4o5mWPejbhlQcHIYj6LXr07J4l8IO1jM8K6lZboZUbayb0yrAjoRkH8K6J4flpwqX0l+BhGrzSlC2qM7/hXPgn/AKE7w3/4K4P/AImj/hXPgn/oTvDf/grg/wDia81/Zt8S313da3ousXk9xcR7biLz5S7DB2OMknvsrov2ifEEujeB0trSd4bq/uFiDRsVYIvzMQR9FH/AquWDlHELD3+ZMcQnS9qdR/wrnwT/ANCd4b/8FcH/AMTR/wAK58E/9Cd4b/8ABXB/8TXhFr4F8dL4SXX5fFCWOntbfays1/OrqhGRkKpGSMcZzyB1q7+z9D4g8QeKzqF3q2pSaZpwzIsty7LJIwIVME4Pcn0wPUVvPL4xhKaqJqJnHFNyUXFq57V/wrnwT/0J3hv/AMFcH/xNH/CufBP/AEJ3hv8A8FcH/wATXgnxP8YePPiB8Sr/AMI/DKe8tbLSG8u4ntZ/ILSKcOzy5BVQ2VCg87ScHoF0/wAcfE3T9Z8O/D7xJZSNr0mq20635YYuLJG3upZeGHycsOdoYEZ6+Ydh6Pd2fgW38Qvpn/CA+G2EaNKzfYoPMEStIrPs8voDDJ37D+JlUld9ceFNNnvzcyISGfzGjKoQW+Yn5iu8Al3yoYA73yPmbJQBzvx30X+2fhtqRRN01jtvE9tmdx/74L1ynw18Z/Y/gVqN20n+laMktuhJ5y3MX4ZdV/CvZ7qCO6tpredQ8UqGN1PdSMEfrXxPqb6hoD674WDExveKkygHLmJnC4Hvuz74Fexl8FiaToy6NP5dTz8VJ0Zqouqa/wAjb+Ed/P4c8f8Ah++uEeO0v2MIc8K6Oxjzn0DgH/gNdt8bpH8V/FnQ/DFu5KQeXC+P4GlIZz+CbD+FT/Grwf8A2L8NvCk1uu2fSQtvMyccuNzN/wB/F/8AH6p/AeO48V/E/VfE2ohWkgRpiQOFkk+VQPYLvH4V3SqQmnjV0TXzvoc6jKP+zPq0/wDM0P2k/FRt47Twnp+Y4QizXOOAQPuR/QY3H/gNdx8BtQ8PS+CoLDQJibm3G+9jlULIZW6uR3BxgEE8ADqK7nUdG0zUlcajp1pdb12t50KuSPqRXzl4bgTwP+0C2m2EhSwMxgKs/HlSR7wpP+ySp5/u1wUnDE4Z0Y6OKv6nTNSpVlUeqenoej/s26IuneAZdSmX/iY6xf3N3cuw+YkSsgB+gXOOxY16bNY2s17b3k1vE91bh1hlZQWjDY3BT2zgZ+lQ6JpcGj2H2O0GIfOllA9PMkaQgewLEVeJx1ryDvFooooAK8K8X+C/tf7QWjTCPNneKt9KSPl3QjDD8dsf/fdel/8ACxvBP/Q4+G//AAaQf/FVG3j/AMCNcJO3i3wwZ0VkSQ6lBuVWILAHdkA7VyO+B6V0YevKg249U0ZVaSqJJ9Hcu/EDRf8AhIfBesaYF3yT27eUP+mi/Mn/AI8BXm3wa8Panb/CDUbjRZ/sms6mzy28xUEgJ8qDDDAztbntuzXoH/CxvBP/AEOPhv8A8GkH/wAVUdv4/wDAltCkNv4t8MRRIMKialAqj6ANTp4mUKTpLun939IUqKlPn8rHkXg340XnhuwuNJ8Y2N9eX9s77ZWbEuSSdkm70PQjtgY4ql8KdCu/iD4+1LxNrVsTppMpkyPkd3QoI1Pfarfhgetet6n4l+F+qzCbVNa8F3soG0PcXVrIwHpliavW3j7wHawJBa+LPC8MKDCRx6jAqqPQANgV1SxtNRl7KFpS3/4BjHDTuueV0tjg0+LX/CvL5/DfxPivRNCT9i1iKHzI7+AfddgORJjAYAEZ54yM8xd/ETV/jN4v0zw/4Btrux8PWV3DealqU67WZY3DKMAkAZXhc5YgdADXrereMPhxrNr9m1fxF4Qv7bOfKur22lTPrhmIpdK8ZfDnSLRbXSfEfhGxtV5ENtfW0SD/AICrAV5h2HbUVyv/AAsbwT/0OPhv/wAGkH/xVFAH/9k=
@@ -0,0 +1 @@
]1337;File=inline=1;size=1658;name=Li4vdGVzdGltYWdlcy93M2NfaG9tZV8yNTYucG5n:iVBORw0KGgoAAAANSUhEUgAAAEgAAAAwCAMAAACFQszZAAADAFBMVEUEAgSMiozMzsxERkR0jrwMQpy8urzc5vQ0ZqwkIiRsbmzc3tx0lsSUqtScnpwkWqz8/vxUfrwcHhy8xuRcXlxkisQUTqTs7uxEcrQ8Pjx8fny0wuQMDgyMjoxMTkwMRpy8vrw8arQsLix0dnTU2uyEnsykttysrqzEzuRsisTs8vwAgl8AADewABfiAACBAAlwzwPVbADkrqSB1thwbwLFAQByAG8AAAEcADBHYAf3GgK/ggIA/ACwaADjHByBggAAfA4AxgAAchQAACB0HEbVRwTk98WBvwGkAO7FYBNyG/cAgr/PAGdsAAGiAADVAABvAOMBaaIAHPcAgr90sBXVxgXkcgCBAABfz6wWbMcArnIA1gCEb1TFARNyAAAAAABQANRCaU35HFG/ggAAuLCwGSji9wCBvwD4kKAIxqMAcvcAAL8AUAAAQgAA+VAAvwC4AIQZYHb3GlG/ggDElFTVDxMAAAAAAADgAAD4AAByAAAAAABtuAwYGQD391C/vwDP0ABs1gCiAFDVAAAA4NQA+E0AclEAAACibUDVGAB/9wBXvwBkzwATbAAArgAA1gAAABgAAAVGAAACAAAArhUA1gUIfwAAVwADR9QAAcd0AHIlAAADAFAAAKU3RvcGAr96AAAzAAClAVCwAABHA2cBAKUAAPcACb/4AwAIAAAAX1AAFgClAEOwAABHpQABsAD4R0PFAQByAAAAAAAYlByJD8V/AFCBAAAQpQLSsAA8RwCCAQAQFKKT1yimZvfSKL/4H/jFF8dyAHIAAAAMlGbGD7RyAPcAAL8YAACJYAB/GlCBggB4ANUKCbQ9A/eCAL8QAACTAEqmA4XSAIEMlO/GDxlyAPgAAL8OADOhABr3APi/AL8mAACzAEr3GoW/IIEARoRgBHY8xVGCAQAAz5sAAW4AAPcAAL/PpB5s2MVmAlDWAABvpOMB2CgAAkIAAAAAABZgAMU7KFCCAAA8HL3Gem5yAvcAAL8YAJuJAG5/APeBAL9EAAQKAAA9DACCFwCk+0jYAAAACXBIWXMAAAAAAAAAAACdYiYyAAADIElEQVR4nO2WW3OqQAyAAUehArJWXcDSUiwg3f//A8/msheU0/bBhzNnutMOEZKPJJtkCYJHLfGg9V+CwjD82DwAFEah/oseABKrciXCR4CeVhsEqUkvRXdjkD2tQ57n4+SWuqFEQnyIVbRKARS3eo30oAfZI8m2lXBL8j89it6C5phqobwIsQn19aOE0AqtcfIsM8uZ1q3B0ELQjkp5J8QZzHWywxJ3LQNrNj1p7cKCsrVFAE1W6I9pik3ZBO9GFUATqPX0ewSb2DxN1hSb9B16NqDnLbrlQBBPy/Eo0M/5IWbvE8WX1sSPgV3O2ye4NuUMtNdKCd+o9Ov3LOdgTRsFeZQo1pQeUR61cBYz0AjOxy5JbKxfsG47lAaIbgCpDGw8R88hAimvADAdB5KBj2EqaffgGgRHY3xxDnGvdVqP4umlTYY4gNhbN4l+DoLUGEflLQiTwTFAEIWNEqUJblZk8Ba8iaVFoB40X0BKaJ/Rj8JsZuXVRO12fAFkbWLuiEFwuwB9dNECqPwKZKIYuSESildCwasCb3VUsvXzIseADmDfY0XJgQvA7EBuOgT3ta6/BAkuaHh1vNdWo6uJwfYs/Dp/A4LirrAREnRh77puGoYhwYaD0t59AxrBd5XhEIEWkzptkssa1oRu6T1IvwHRdCto5+GCloNTxD2E3J+XMN5xBAXUsS4MqM6WEy/wEG6830NmoIxTCvUycXILXxPyJ/M7wB2o5wmGHcUj+uRr9u081r+BBHukKIzWGwKewk9AZEwzYKROmR0+MTj5eZOhm3mEC4cGT1mFoe1nNpi44ab1aztSHEhhWrjHKwM97M0MzuDx9Drb/TC43oPQ2FRgzmWd2EypAoNN/SkSNW5oe6DcnSVYnwCFxNFJlXEGt46kOTfHkTWW9rQuJM0nLIRh6rEc4bE+FEOOS3MuYgGkO0NaOePTcPAPbMz+FU7G63UL52STLoIyrwInA63MNNJzgcphZz9km0gsgiZzJMGSDFWfxp/OlNWu4SPb48w//aRXgScLnWDQtZ33knR7CYL6dTa8/6Wv2l/Qj0GPWn8AP2jx/kucqREAAAAASUVORK5CYII=
@@ -0,0 +1,67 @@
#!/bin/bash
function print_palette() {
L=$(( LOWER / 256))
U=$(( (UPPER-1) / 256))
for ((p = $L; p <= $U; p++))
do
echo "slot $((p*256))..$((p*256+255)):"
echo -ne "\x1bP;1q"
for i in {0..15}
do
a=$((i * 16 + p * 256))
for j in {0..15}
do
echo -ne "#$((a+j))!6~"
done
echo -ne "\$-"
done
echo -e "\x1b\\"
done
}
colors=undefined
max_colors=undefined
echo "Terminal Reports (XTSMGRAPHICS):"
IFS=";" read -a REPLY -s -t 1 -d "S" -p $'\e[?1;1;0S'
[[ ${REPLY[1]} == "0" ]] && colors=${REPLY[2]}
echo "active colors: ${colors}"
IFS=";" read -a REPLY -s -t 1 -d "S" -p $'\e[?1;4;0S'
[[ ${REPLY[1]} == "0" ]] && max_colors=${REPLY[2]}
echo "max colors : ${max_colors}"
echo
# query up to colors by default
# if colors is undefined (no XTSMGRAPHICS), assume 256
ARG1=${1:-${colors}}
if [[ $colors == "undefined" ]]
then
ARG1=${1:-256}
fi
LOWER=0
UPPER=$ARG1
ARG2=${2:-undefined}
if [[ $ARG2 != "undefined" ]]
then
LOWER=ARG1
UPPER=ARG2
fi
if [[ $colors != "undefined" ]]
then
if [[ $colors -lt $UPPER ]] || [[ $colors -lt 256 ]]
then
echo -e "\x1b[33mNote: Active colors is smaller than test range."
echo -e "A spec-conform terminal may repeat colors in 'slot mod ${colors}'.\x1b[m"
echo
fi
else
echo -e "\x1b[33mNote: Cannot query active colors."
echo -e "The terminal may repeat colors beyond it max slot (e.g. slot mod 16).\x1b[m"
echo
fi
print_palette
+141
View File
@@ -0,0 +1,141 @@
#!/bin/bash
function smiling_smiley() {
echo -ne '\x1bP;2q"1;1;60;60
#6!60~$-
!60~$-
!60~$
!15?#1!4]!22?!4]$-
#6!60~$-
!60~$-
!60~$-
!60~$
!15?#1!4~!22?!4~$-
#6!60~$
!15?#1!30N$-
#6!60~$-
!60~$-
'
echo -ne '\x1b\\'
}
function indifferent_smiley() {
echo -ne '\x1bP;2q"1;1;60;60
#6!60~$-
!60~$-
!60~$
!15?#1!4]!22?!4]$-
#6!60~$-
!60~$-
!60~$-
!60~$-
!60~$
!15?#1!30N$-
#6!60~$-
!60~$-
'
echo -ne '\x1b\\'
}
function sad_smiley() {
echo -ne '\x1bP;2q"1;1;60;60
#6!60~$-
!60~$-
!60~$
!15?#1!4]!22?!4]$-
#6!60~$-
!60~$-
!60~$-
!60~$-
!60~$
!15?#1!30N$
!15?#1!4o!22?!4o$-
#6!60~$
!15?#1!4B!22?!4B$-
#6!60~$-
'
echo -ne '\x1b\\'
}
function smiling_smiley_slim() {
echo -ne '\x1bP;1q"1;1;60;60
$-
$-
$-
$-
$-
$-
!15?#1!4~!22?!4~$-
!15?#1!30N
'
echo -ne '\x1b\\'
}
function indifferent_smiley_slim() {
echo -ne '\x1bP;1q"1;1;60;60
$-
$-
$-
$-
$-
$-
!15?#6!4~!22?!4~$-
!15?!4o!22?!4o$ !15?#1!30N$-
!15?#6!4B!22?!4B
'
echo -ne '\x1b\\'
}
function sad_smiley_slim() {
echo -ne '\x1bP;1q"1;1;60;60
$-
$-
$-
$-
$-
$-
$-
!15?#1!30N$
!15?#1!4o!22?!4o$-
!15?#1!4B!22?!4B$-
'
echo -ne '\x1b\\'
}
function full() {
smiling_smiley
sleep .5
indifferent_smiley
sleep .5
sad_smiley
sleep .5
indifferent_smiley
sleep .5
smiling_smiley
}
function slim() {
smiling_smiley
sleep .5
indifferent_smiley_slim
sleep .5
sad_smiley_slim
sleep .5
indifferent_smiley_slim
sleep .5
smiling_smiley_slim
}
# clear screen and place cursor to 1;10
echo -ne '\x1b[2J\x1b[10;1H'
# switch sixel scrolling off
echo -ne '\x1b[?80h'
case "$1" in
full ) full ;;
slim ) slim ;;
esac
# re-enable sixel scrolling
echo -ne '\x1b[?80l'
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

+288
View File
@@ -0,0 +1,288 @@
#!/bin/bash
# Test cursor row, column placement after sixel image is sent.
# After a sixel image is displayed, the text cursor is moved to the
# row of the last sixel cursor position, but the column stays the same
# as it was before the sixel image was sent.
#
# This can be thought of as sixel images always ending with an
# implicit Graphics Carriage Return (`$`).
# ADDENDUM: It is not as simple as I thought. When a row of sixels
# straddles two rows of text, the text cursor can be left on the upper row.
# It seems up to three lines of pixels may be beneath any words printed.
#
# The rule for when this happens is not obvious to me, but can be seen
# with images of height: 21, 22, 23, 24, 41, 42, 81, 82, 83, 84...
#
# My guess:
# for a sixel image of height h, let a=(h-1)%6 and b=(h-1)%20,
# then, the text will overlap the image when a>b.
#
# If that is the case, then the entire list of heights for which this
# will happen on the VT340's 480 pixel high screen is:
#
# 21 22 23 24 41 42 81 82 83 84
# 101 102 141 142 143 144 161 162
# 201 202 203 204 221 222 261 262 263 264 281 282
# 321 322 323 324 341 342 381 382 383 384
# 401 402 441 442 443 444 461 462
#
# Note that there are 48 entries, so that means there's a 10% chance
# if heights are chosen randomly from 1 to 480. However, if one were
# to always pick heights which are a multiple of the character cell
# height (20px), then the chances are 0% as there are no problematic
# heights divisible by 20.
# Sixel images often do *not* end with a `-` (Graphics New Line = GNL)
# which sends the sixel cursor down 6 pixels. Any text printed next
# will potentially overlap the last row of sixels!
# I am not yet positive, but I believe that, in general, applications
# should send sixel images without a GNL but then send `^J`, a text
# newline (NL), before displaying more text or graphics.
# IMPORTANT: sometimes neither a graphics nor a text newline is wanted.
# For example, if an image is full screen, either newline would cause
# the top line to scroll off the screen.
# | Text cursor column | Text cursor row
# --------|--------------------|-------------------------------------
# !GNL !NL| Unchanged | Overlapping last line of graphics
# !GNL NL| Column=1 | First line immediately after graphic (usually)
# GNL !NL| Unchanged | _Sometimes_ overlapping graphics
# GNL NL| Column=1 | First *or* second line after graphic
CSI=$'\e[' # Control Sequence Introducer
DCS=$'\eP' # Device Control String
ST=$'\e\\' # String Terminator
set_cursor_pos() {
# Home, top left is row 1, col 1.
local row=$1 col=$2
echo -n ${CSI}${row}';'${col}'H'
}
reset_palette() {
# Send DECRSTS to load colors from a Color Table Report
echo -n ${DCS}'2$p'
echo -n "0;2;0;0;0/" # VT color #0 is black and BG text color
echo -n "1;2;20;20;79/" # VT color #1 is blue
echo -n "2;2;79;13;13/" # VT color #2 is red
echo -n "3;2;20;79;20/" # VT color #3 is green
echo -n "4;2;79;20;79/" # VT color #4 is magenta
echo -n "5;2;20;79;79/" # VT color #5 is cyan
echo -n "6;2;79;79;20/" # VT color #6 is yellow
echo -n "7;2;46;46;46/" # VT color #7 is gray 50% and FG text color
echo -n "8;2;26;26;26/" # VT color #8 is gray 25%
echo -n "9;2;33;33;59/" # VT color #9 is pastel blue
echo -n "10;2;59;26;26/" # VT color #10 is pastel red
echo -n "11;2;33;59;33/" # VT color #11 is pastel green
echo -n "12;2;59;33;59/" # VT color #12 is pastel magenta
echo -n "13;2;33;59;59/" # VT color #13 is pastel cyan
echo -n "14;2;59;59;33/" # VT color #14 is pastel yellow
echo -n "15;2;79;79;79" # VT color #15 is gray 75% and BOLD text color
echo -n ${ST} # String Terminator
}
# Generate square of size w with final graphics new line removed
square() {
# Given a color index number and (optionally) a size, row, and column,
# draw a square with top left corner at (row, column) and of size×size px.
# Default size 100×100px (10cols, 5 rows)
local -i color=${1:-1} # Default is color index 1 (blue)
local -i size=${2:-100} # Size in pixels (defaults to 100)
local -i row=$3 column=$4 # If set to 0, cursor is not moved
if [[ row -ne 0 && column -ne 0 ]]; then
set_cursor_pos $row $column
fi
# Draw a square of the right color & size
squaresize $color $size
}
squaresize() {
# Helper for square() that uses convert to return a sixel square of
# the right color ($1) and size ($2).
# Similar to this but with variable size squares:
# echo -n ${DCS}'0;0;0q"1;1;100;100#'${color}'!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100N'${ST}
local color=${1:-1} # Default color index is 1 (blue)
local size=${2:-100} # Default size is 100x100
# Get a sixel string
local sq=$(convert -geometry ${size}x${size} xc:black sixel:-)
# Remove ImageMagick's extraneous Graphic New Line at end of image.
sq=${sq%-??}$'\e\\'
# VT340s always used the same color register for the first sixel
# color defined no matter what number it was assigned. That means,
# each time we send a new sixel image, the previous one's color
# palette gets changed. We don't want squares of all the same
# color, so remove the color definition and just use the defaults.
sq=${sq/\#0;2;0;0;0/}
# And finally, switch to the proper index for the color we want.
echo -n ${sq//\#0/#${color}}
}
squaregnl() {
# Same as square(), but sends a graphics newline at the end of the sixels.
# (Sticks a `-` before the String Terminator, "Esc \")
sq=$(square "${@}")
echo -n ${sq%??}$'-\e\\'
}
main() {
clear
reset_palette
show_labels
neither_graphic_nor_text 96 4 4 31 # size, color, row, column
text_newline_only 96 9 4 1
text_newline_only 84 9 4 14
graphics_new_line_only 100 1 4 51
graphics_new_line_only 96 1 4 64
set_cursor_pos 1000 1
}
neither_graphic_nor_text() {
# Typically sixel images should not end with a Graphics New Line (GNL)
# However, if a text newline isn't sent, there will be overlap.
local -i size color row column
read size color row column <<<"$@"
set_cursor_pos $((row++)) $column
echo -n "Height $size"
set_cursor_pos $((row++)) $column
# Three squares sent as separate sixel images, indented +1
for i in {1..3}; do
square $((color++)) $size
tput cuf 1
done
echo -n "overlap?"
}
text_newline_only() {
# USING A TEXT NEWLINE (NL) after an sixel image that does NOT
# have GNL is probably the best way to be on the text line
# immediately below the image. However, the text will still
# occasionally overlap the last four rows of pixels.
# Also, if multiple images are intended to be shown, there will
# usually be a gap between them when using a text newline.
# Overlap happens because the height of a text cell is 20 pixels
# and the height of a sixel is 6.
# for (h=0; h<480; h++) if ((h-1)%6 > (h-1)%20 ) { h }
# Let the pixel position of the top of the graphics cursor be 'Yg'
# and let the pixel position of the top of the corresponding cell
# of text which the text cursor will be placed on be 'Yt'. Note
# that Yg is evenly divisible by 6 and Yt, by 20. Taking the
# remainder, r, after dividing Yg by 20 tells us how many pixels
# down into a row of text the last line of sixels started. When
# r==0, the sixels started at the top of the text row.
# When r = 14, the sixels covered the bottom six pixels on the row
# of text. When 14 < r < 20, the sixel line impinged by r - 14
# pixels into the text row below and there is a chance the next
# text printed will overlap.
local -i size color row column
read size color row column <<<"$@"
local -i offset
offset=$((column-1))
set_cursor_pos $row 1
if ((offset)); then tput cuf $((offset)); fi
echo "Height $size"
# Three squares, separated by text new lines and indented +1
for i in {1..3}; do
if ((offset)); then tput cuf $offset; fi
square $((color++)) $size
offset=offset+1
echo
done
tput cuf $((offset))
echo -n "overlap?"
}
graphics_new_line_only() {
# However, some sixel images end with a `-`, a Graphics New Line.
# This can be useful for writing another image starting at the same
# column without having to reposition the cursor.
#
# However, this runs the risk of having occasional overlap.
local -i size color row column
read size color row column <<<"$@"
set_cursor_pos $((row++)) $column
echo -n "Height $size"
set_cursor_pos $((row++)) $column
# Three squares, separated by graphics new lines and indented +1
for i in {1..3}; do
squaregnl $((color++)) $size
tput cuf 1
done
echo -n "overlap?"
}
show_labels() {
set_cursor_pos 1 10
echo -n "Should sixel images include a GNL ('-') at the end?"
set_cursor_pos 3 29
echo -n "Neither NL nor GNL"
set_cursor_pos 3 1
echo -n "Text New Line only"
set_cursor_pos 3 51
echo -n "Graphics New Line only"
set_cursor_pos 22 29
echo -n "Always overlaps" # Neither NL nor GNL
set_cursor_pos 22 3
echo -n "Overlaps a little" # NL only
set_cursor_pos 23 3
echo -n " Gaps a little" # NL only
set_cursor_pos 22 54
echo -n "Overlaps badly" # GNL only
set_cursor_pos 23 54
echo -n "Never gaps" # GNL only
}
main
+31
View File
@@ -0,0 +1,31 @@
{
"name": "@xterm/addon-image",
"version": "0.7.0",
"author": {
"name": "The xterm.js authors",
"url": "https://xtermjs.org/"
},
"main": "lib/addon-image.js",
"types": "typings/addon-image.d.ts",
"repository": "https://github.com/xtermjs/xterm.js/tree/master/addons/addon-image",
"license": "MIT",
"keywords": [
"terminal",
"image",
"sixel",
"xterm",
"xterm.js"
],
"scripts": {
"prepackage": "../../node_modules/.bin/tsc -p .",
"package": "../../node_modules/.bin/webpack",
"prepublishOnly": "npm run package"
},
"peerDependencies": {
"@xterm/xterm": "^5.2.0"
},
"devDependencies": {
"sixel": "^0.16.0",
"xterm-wasm-parts": "^0.1.0"
}
}
+161
View File
@@ -0,0 +1,161 @@
/**
* Copyright (c) 2023 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { IImageAddonOptions, IOscHandler, IResetHandler, ITerminalExt } from './Types';
import { ImageRenderer } from './ImageRenderer';
import { ImageStorage, CELL_SIZE_DEFAULT } from './ImageStorage';
import Base64Decoder from 'xterm-wasm-parts/lib/base64/Base64Decoder.wasm';
import { HeaderParser, IHeaderFields, HeaderState } from './IIPHeaderParser';
import { imageType, UNSUPPORTED_TYPE } from './IIPMetrics';
// eslint-disable-next-line
declare const Buffer: any;
// limit hold memory in base64 decoder
const KEEP_DATA = 4194304;
// default IIP header values
const DEFAULT_HEADER: IHeaderFields = {
name: 'Unnamed file',
size: 0,
width: 'auto',
height: 'auto',
preserveAspectRatio: 1,
inline: 0
};
export class IIPHandler implements IOscHandler, IResetHandler {
private _aborted = false;
private _hp = new HeaderParser();
private _header: IHeaderFields = DEFAULT_HEADER;
private _dec = new Base64Decoder(KEEP_DATA);
private _metrics = UNSUPPORTED_TYPE;
constructor(
private readonly _opts: IImageAddonOptions,
private readonly _renderer: ImageRenderer,
private readonly _storage: ImageStorage,
private readonly _coreTerminal: ITerminalExt
) {}
public reset(): void {}
public start(): void {
this._aborted = false;
this._header = DEFAULT_HEADER;
this._metrics = UNSUPPORTED_TYPE;
this._hp.reset();
}
public put(data: Uint32Array, start: number, end: number): void {
if (this._aborted) return;
if (this._hp.state === HeaderState.END) {
if (this._dec.put(data, start, end)) {
this._dec.release();
this._aborted = true;
}
} else {
const dataPos = this._hp.parse(data, start, end);
if (dataPos === -1) {
this._aborted = true;
return;
}
if (dataPos > 0) {
this._header = Object.assign({}, DEFAULT_HEADER, this._hp.fields);
if (!this._header.inline || !this._header.size || this._header.size > this._opts.iipSizeLimit) {
this._aborted = true;
return;
}
this._dec.init(this._header.size);
if (this._dec.put(data, dataPos, end)) {
this._dec.release();
this._aborted = true;
}
}
}
}
public end(success: boolean): boolean | Promise<boolean> {
if (this._aborted) return true;
let w = 0;
let h = 0;
// early exit condition chain
let cond: number | boolean = true;
if (cond = success) {
if (cond = !this._dec.end()) {
this._metrics = imageType(this._dec.data8);
if (cond = this._metrics.mime !== 'unsupported') {
w = this._metrics.width;
h = this._metrics.height;
if (cond = w && h && w * h < this._opts.pixelLimit) {
[w, h] = this._resize(w, h).map(Math.floor);
cond = w && h && w * h < this._opts.pixelLimit;
}
}
}
}
if (!cond) {
this._dec.release();
return true;
}
const blob = new Blob([this._dec.data8], { type: this._metrics.mime });
this._dec.release();
if (!window.createImageBitmap) {
const url = URL.createObjectURL(blob);
const img = new Image();
return new Promise<boolean>(r => {
img.addEventListener('load', () => {
URL.revokeObjectURL(url);
const canvas = ImageRenderer.createCanvas(window.document, w, h);
canvas.getContext('2d')?.drawImage(img, 0, 0, w, h);
this._storage.addImage(canvas);
r(true);
});
img.src = url;
// sanity measure to avoid terminal blocking from dangling promise
// happens from corrupt data (onload never gets fired)
setTimeout(() => r(true), 1000);
});
}
return createImageBitmap(blob, { resizeWidth: w, resizeHeight: h })
.then(bm => {
this._storage.addImage(bm);
return true;
});
}
private _resize(w: number, h: number): [number, number] {
const cw = this._renderer.dimensions?.css.cell.width || CELL_SIZE_DEFAULT.width;
const ch = this._renderer.dimensions?.css.cell.height || CELL_SIZE_DEFAULT.height;
const width = this._renderer.dimensions?.css.canvas.width || cw * this._coreTerminal.cols;
const height = this._renderer.dimensions?.css.canvas.height || ch * this._coreTerminal.rows;
const rw = this._dim(this._header.width!, width, cw);
const rh = this._dim(this._header.height!, height, ch);
if (!rw && !rh) {
const wf = width / w; // TODO: should this respect initial cursor offset?
const hf = (height - ch) / h; // TODO: fix offset issues from float cell height
const f = Math.min(wf, hf);
return f < 1 ? [w * f, h * f] : [w, h];
}
return !rw
? [w * rh / h, rh]
: this._header.preserveAspectRatio || !rw || !rh
? [rw, h * rw / w] : [rw, rh];
}
private _dim(s: string, total: number, cdim: number): number {
if (s === 'auto') return 0;
if (s.endsWith('%')) return parseInt(s.slice(0, -1)) * total / 100;
if (s.endsWith('px')) return parseInt(s.slice(0, -2));
return parseInt(s) * cdim;
}
}
@@ -0,0 +1,138 @@
/**
* Copyright (c) 2023 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { assert } from 'chai';
import { HeaderParser, HeaderState, IHeaderFields } from './IIPHeaderParser';
const CASES: [string, IHeaderFields][] = [
['File=size=123456;name=dGVzdA==:', {name: 'test', size: 123456}],
['File=size=123456;name=dGVzdA:', {name: 'test', size: 123456}],
// utf-8 encoding in name
['File=size=123456;name=w7xtbMOkdXTDnw==:', {name: 'ümläutß', size: 123456}],
['File=size=123456;name=w7xtbMOkdXTDnw:', {name: 'ümläutß', size: 123456}],
// full header spec
[
'File=inline=1;width=10px;height=20%;preserveAspectRatio=1;size=123456;name=w7xtbMOkdXTDnw:',
{
inline: 1,
width: '10px',
height: '20%',
preserveAspectRatio: 1,
size: 123456,
name: 'ümläutß'
}
],
[
'File=inline=1;width=auto;height=20;preserveAspectRatio=1;size=123456;name=w7xtbMOkdXTDnw:',
{
inline: 1,
width: 'auto',
height: '20',
preserveAspectRatio: 1,
size: 123456,
name: 'ümläutß'
}
]
];
function fromBs(bs: string): Uint32Array {
const r = new Uint32Array(bs.length);
for (let i = 0; i < r.length; ++i) r[i] = bs.charCodeAt(i);
return r;
}
describe('IIPHeaderParser', () => {
it('at once', () => {
const hp = new HeaderParser();
for (const example of CASES) {
hp.reset();
const inp = fromBs(example[0]);
const res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, inp.length);
assert.strictEqual(hp.state, HeaderState.END);
assert.deepEqual(hp.fields, example[1]);
}
});
it('bytewise', () => {
const hp = new HeaderParser();
for (const example of CASES) {
hp.reset();
const inp = fromBs(example[0]);
let pos = 0;
let res = -2;
while (res === -2 && pos < inp.length) {
res = hp.parse(new Uint32Array([inp[pos++]]), 0, 1);
}
assert.strictEqual(res, 1);
assert.strictEqual(hp.state, HeaderState.END);
assert.deepEqual(hp.fields, example[1]);
}
});
it('no File= starter', () => {
const hp = new HeaderParser();
let inp = fromBs('size=123456;name=dGVzdA==:');
let res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, -1);
hp.reset();
inp = fromBs(CASES[0][0]);
res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, inp.length);
assert.strictEqual(hp.state, HeaderState.END);
assert.deepEqual(hp.fields, CASES[0][1]);
});
it('empty key - error', () => {
const hp = new HeaderParser();
let inp = fromBs('File=size=123456;=dGVzdA==:');
let res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, -1);
hp.reset();
inp = fromBs(CASES[0][0]);
res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, inp.length);
assert.strictEqual(hp.state, HeaderState.END);
assert.deepEqual(hp.fields, CASES[0][1]);
});
it('empty size value - set to 0', () => {
const hp = new HeaderParser();
let inp = fromBs('File=size=;name=dGVzdA==:');
let res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, inp.length);
assert.strictEqual(hp.state, HeaderState.END);
assert.deepEqual(hp.fields, {name: 'test', size: 0});
hp.reset();
inp = fromBs(CASES[0][0]);
res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, inp.length);
assert.strictEqual(hp.state, HeaderState.END);
assert.deepEqual(hp.fields, CASES[0][1]);
});
it('empty name value - set to empty string', () => {
const hp = new HeaderParser();
let inp = fromBs('File=size=123456;name=:');
let res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, inp.length);
assert.strictEqual(hp.state, HeaderState.END);
assert.deepEqual(hp.fields, {name: '', size: 123456});
hp.reset();
inp = fromBs(CASES[0][0]);
res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, inp.length);
assert.strictEqual(hp.state, HeaderState.END);
assert.deepEqual(hp.fields, CASES[0][1]);
});
it('empty size value - error', () => {
const hp = new HeaderParser();
let inp = fromBs('File=inline=1;width=;height=20%;preserveAspectRatio=1;size=123456;name=w7xtbMOkdXTDnw:');
let res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, -1);
hp.reset();
inp = fromBs(CASES[0][0]);
res = hp.parse(inp, 0, inp.length);
assert.strictEqual(res, inp.length);
assert.strictEqual(hp.state, HeaderState.END);
assert.deepEqual(hp.fields, CASES[0][1]);
});
});
+186
View File
@@ -0,0 +1,186 @@
/**
* Copyright (c) 2023 The xterm.js authors. All rights reserved.
* @license MIT
*/
// eslint-disable-next-line
declare const Buffer: any;
export interface IHeaderFields {
// base-64 encoded filename. Defaults to "Unnamed file".
name: string;
// File size in bytes. The file transfer will be canceled if this size is exceeded.
size: number;
/**
* Optional width and height to render:
* - N: N character cells.
* - Npx: N pixels.
* - N%: N percent of the session's width or height.
* - auto: The image's inherent size will be used to determine an appropriate dimension.
*/
width?: string;
height?: string;
// Optional, defaults to 1 respecting aspect ratio (width takes precedence).
preserveAspectRatio?: number;
// Optional, defaults to 0. If set to 1, the file will be displayed inline, else downloaded
// (download not supported).
inline?: number;
}
export const enum HeaderState {
START = 0,
ABORT = 1,
KEY = 2,
VALUE = 3,
END = 4
}
// field value decoders
// ASCII bytes to string
function toStr(data: Uint32Array): string {
let s = '';
for (let i = 0; i < data.length; ++i) {
s += String.fromCharCode(data[i]);
}
return s;
}
// digits to integer
function toInt(data: Uint32Array): number {
let v = 0;
for (let i = 0; i < data.length; ++i) {
if (data[i] < 48 || data[i] > 57) {
throw new Error('illegal char');
}
v = v * 10 + data[i] - 48;
}
return v;
}
// check for correct size entry
function toSize(data: Uint32Array): string {
const v = toStr(data);
if (!v.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/)) {
throw new Error('illegal size');
}
return v;
}
// name is base64 encoded utf-8
function toName(data: Uint32Array): string {
if (typeof Buffer !== 'undefined') {
return Buffer.from(toStr(data), 'base64').toString();
}
const bs = atob(toStr(data));
const b = new Uint8Array(bs.length);
for (let i = 0; i < b.length; ++i) {
b[i] = bs.charCodeAt(i);
}
return new TextDecoder().decode(b);
}
const DECODERS: {[key: string]: (v: Uint32Array) => any} = {
inline: toInt,
size: toInt,
name: toName,
width: toSize,
height: toSize,
preserveAspectRatio: toInt
};
const FILE_MARKER = [70, 105, 108, 101];
const MAX_FIELDCHARS = 1024;
export class HeaderParser {
public state: HeaderState = HeaderState.START;
private _buffer = new Uint32Array(MAX_FIELDCHARS);
private _position = 0;
private _key = '';
public fields: {[key: string]: any} = {};
public reset(): void {
this._buffer.fill(0);
this.state = HeaderState.START;
this._position = 0;
this.fields = {};
this._key = '';
}
public parse(data: Uint32Array, start: number, end: number): number {
let state = this.state;
let pos = this._position;
const buffer = this._buffer;
if (state === HeaderState.ABORT || state === HeaderState.END) return -1;
if (state === HeaderState.START && pos > 6) return -1;
for (let i = start; i < end; ++i) {
const c = data[i];
switch (c) {
case 59: // ;
if (!this._storeValue(pos)) return this._a();
state = HeaderState.KEY;
pos = 0;
break;
case 61: // =
if (state === HeaderState.START) {
for (let k = 0; k < FILE_MARKER.length; ++k) {
if (buffer[k] !== FILE_MARKER[k]) return this._a();
}
state = HeaderState.KEY;
pos = 0;
} else if (state === HeaderState.KEY) {
if (!this._storeKey(pos)) return this._a();
state = HeaderState.VALUE;
pos = 0;
} else if (state === HeaderState.VALUE) {
if (pos >= MAX_FIELDCHARS) return this._a();
buffer[pos++] = c;
}
break;
case 58: // :
if (state === HeaderState.VALUE) {
if (!this._storeValue(pos)) return this._a();
}
this.state = HeaderState.END;
return i + 1;
default:
if (pos >= MAX_FIELDCHARS) return this._a();
buffer[pos++] = c;
}
}
this.state = state;
this._position = pos;
return -2;
}
private _a(): number {
this.state = HeaderState.ABORT;
return -1;
}
private _storeKey(pos: number): boolean {
const k = toStr(this._buffer.subarray(0, pos));
if (k) {
this._key = k;
this.fields[k] = null;
return true;
}
return false;
}
private _storeValue(pos: number): boolean {
if (this._key) {
try {
const v = this._buffer.slice(0, pos);
this.fields[this._key] = DECODERS[this._key] ? DECODERS[this._key](v) : v;
} catch (e) {
return false;
}
return true;
}
return false;
}
}
+43
View File
@@ -0,0 +1,43 @@
/**
* Copyright (c) 2023 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { assert } from 'chai';
import { imageType, IMetrics } from './IIPMetrics';
// fix missing nodejs decl
declare const require: (s: string) => any;
const fs = require('fs');
const TEST_IMAGES: [string, IMetrics][] = [
['w3c_home_256.gif', { mime: 'image/gif', width: 72, height: 48 }],
['w3c_home_256.jpg', { mime: 'image/jpeg', width: 72, height: 48 }],
['w3c_home_256.png', { mime: 'image/png', width: 72, height: 48 }],
['w3c_home_2.gif', { mime: 'image/gif', width: 72, height: 48 }],
['w3c_home_2.jpg', { mime: 'image/jpeg', width: 72, height: 48 }],
['w3c_home_2.png', { mime: 'image/png', width: 72, height: 48 }],
['w3c_home_animation.gif', { mime: 'image/gif', width: 72, height: 48 }],
['w3c_home.gif', { mime: 'image/gif', width: 72, height: 48 }],
['w3c_home_gray.gif', { mime: 'image/gif', width: 72, height: 48 }],
['w3c_home_gray.jpg', { mime: 'image/jpeg', width: 72, height: 48 }],
['w3c_home_gray.png', { mime: 'image/png', width: 72, height: 48 }],
['w3c_home.jpg', { mime: 'image/jpeg', width: 72, height: 48 }],
['w3c_home.png', { mime: 'image/png', width: 72, height: 48 }],
['spinfox.png', { mime: 'image/png', width: 148, height: 148 }],
['iphone_hdr_YES.jpg', { mime: 'image/jpeg', width: 3264, height: 2448 }],
['nikon-e950.jpg', { mime: 'image/jpeg', width: 800, height: 600 }],
['agfa-makernotes.jpg', { mime: 'image/jpeg', width: 8, height: 8 }],
['sony-alpha-6000.jpg', { mime: 'image/jpeg', width: 6000, height: 4000 }]
];
describe('IIPMetrics', () => {
it('bunch of testimages', () => {
for (let i = 0; i < TEST_IMAGES.length; ++i) {
const imageData = fs.readFileSync('./addons/addon-image/fixture/testimages/' + TEST_IMAGES[i][0]);
assert.deepStrictEqual(imageType(imageData), TEST_IMAGES[i][1]);
}
});
});
+81
View File
@@ -0,0 +1,81 @@
/**
* Copyright (c) 2023 The xterm.js authors. All rights reserved.
* @license MIT
*/
export type ImageType = 'image/png' | 'image/jpeg' | 'image/gif' | 'unsupported' | '';
export interface IMetrics {
mime: ImageType;
width: number;
height: number;
}
export const UNSUPPORTED_TYPE: IMetrics = {
mime: 'unsupported',
width: 0,
height: 0
};
export function imageType(d: Uint8Array): IMetrics {
if (d.length < 24) {
return UNSUPPORTED_TYPE;
}
const d32 = new Uint32Array(d.buffer, d.byteOffset, 6);
// PNG: 89 50 4E 47 0D 0A 1A 0A (8 first bytes == magic number for PNG)
// + first chunk must be IHDR
if (d32[0] === 0x474E5089 && d32[1] === 0x0A1A0A0D && d32[3] === 0x52444849) {
return {
mime: 'image/png',
width: d[16] << 24 | d[17] << 16 | d[18] << 8 | d[19],
height: d[20] << 24 | d[21] << 16 | d[22] << 8 | d[23]
};
}
// JPEG: FF D8 FF E0 xx xx JFIF or FF D8 FF E1 xx xx Exif 00 00
if ((d32[0] === 0xE0FFD8FF || d32[0] === 0xE1FFD8FF)
&& (
(d[6] === 0x4a && d[7] === 0x46 && d[8] === 0x49 && d[9] === 0x46)
|| (d[6] === 0x45 && d[7] === 0x78 && d[8] === 0x69 && d[9] === 0x66)
)
) {
const [width, height] = jpgSize(d);
return { mime: 'image/jpeg', width, height };
}
// GIF: GIF87a or GIF89a
if (d32[0] === 0x38464947 && (d[4] === 0x37 || d[4] === 0x39) && d[5] === 0x61) {
return {
mime: 'image/gif',
width: d[7] << 8 | d[6],
height: d[9] << 8 | d[8]
};
}
return UNSUPPORTED_TYPE;
}
function jpgSize(d: Uint8Array): [number, number] {
const len = d.length;
let i = 4;
let blockLength = d[i] << 8 | d[i + 1];
while (true) {
i += blockLength;
if (i >= len) {
// exhausted without size info
return [0, 0];
}
if (d[i] !== 0xFF) {
return [0, 0];
}
if (d[i + 1] === 0xC0 || d[i + 1] === 0xC2) {
if (i + 8 < len) {
return [
d[i + 7] << 8 | d[i + 8],
d[i + 5] << 8 | d[i + 6]
];
}
return [0, 0];
}
i += 2;
blockLength = d[i] << 8 | d[i + 1];
}
}
+317
View File
@@ -0,0 +1,317 @@
/**
* Copyright (c) 2020 The xterm.js authors. All rights reserved.
* @license MIT
*/
import type { ITerminalAddon, IDisposable } from '@xterm/xterm';
import type { ImageAddon as IImageApi } from '@xterm/addon-image';
import { IIPHandler } from './IIPHandler';
import { ImageRenderer } from './ImageRenderer';
import { ImageStorage, CELL_SIZE_DEFAULT } from './ImageStorage';
import { SixelHandler } from './SixelHandler';
import { ITerminalExt, IImageAddonOptions, IResetHandler } from './Types';
// default values of addon ctor options
const DEFAULT_OPTIONS: IImageAddonOptions = {
enableSizeReports: true,
pixelLimit: 16777216, // limit to 4096 * 4096 pixels
sixelSupport: true,
sixelScrolling: true,
sixelPaletteLimit: 256,
sixelSizeLimit: 25000000,
storageLimit: 128,
showPlaceholder: true,
iipSupport: true,
iipSizeLimit: 20000000
};
// max palette size supported by the sixel lib (compile time setting)
const MAX_SIXEL_PALETTE_SIZE = 4096;
// definitions for _xtermGraphicsAttributes sequence
const enum GaItem {
COLORS = 1,
SIXEL_GEO = 2,
REGIS_GEO = 3
}
const enum GaAction {
READ = 1,
SET_DEFAULT = 2,
SET = 3,
READ_MAX = 4
}
const enum GaStatus {
SUCCESS = 0,
ITEM_ERROR = 1,
ACTION_ERROR = 2,
FAILURE = 3
}
export class ImageAddon implements ITerminalAddon , IImageApi {
private _opts: IImageAddonOptions;
private _defaultOpts: IImageAddonOptions;
private _storage: ImageStorage | undefined;
private _renderer: ImageRenderer | undefined;
private _disposables: IDisposable[] = [];
private _terminal: ITerminalExt | undefined;
private _handlers: Map<String, IResetHandler> = new Map();
constructor(opts?: Partial<IImageAddonOptions>) {
this._opts = Object.assign({}, DEFAULT_OPTIONS, opts);
this._defaultOpts = Object.assign({}, DEFAULT_OPTIONS, opts);
}
public dispose(): void {
for (const obj of this._disposables) {
obj.dispose();
}
this._disposables.length = 0;
this._handlers.clear();
}
private _disposeLater(...args: IDisposable[]): void {
for (const obj of args) {
this._disposables.push(obj);
}
}
public activate(terminal: ITerminalExt): void {
this._terminal = terminal;
// internal data structures
this._renderer = new ImageRenderer(terminal);
this._storage = new ImageStorage(terminal, this._renderer, this._opts);
// enable size reports
if (this._opts.enableSizeReports) {
// const windowOptions = terminal.getOption('windowOptions');
// windowOptions.getWinSizePixels = true;
// windowOptions.getCellSizePixels = true;
// windowOptions.getWinSizeChars = true;
// terminal.setOption('windowOptions', windowOptions);
const windowOps = terminal.options.windowOptions || {};
windowOps.getWinSizePixels = true;
windowOps.getCellSizePixels = true;
windowOps.getWinSizeChars = true;
terminal.options.windowOptions = windowOps;
}
this._disposeLater(
this._renderer,
this._storage,
// DECSET/DECRST/DA1/XTSMGRAPHICS handlers
terminal.parser.registerCsiHandler({ prefix: '?', final: 'h' }, params => this._decset(params)),
terminal.parser.registerCsiHandler({ prefix: '?', final: 'l' }, params => this._decrst(params)),
terminal.parser.registerCsiHandler({ final: 'c' }, params => this._da1(params)),
terminal.parser.registerCsiHandler({ prefix: '?', final: 'S' }, params => this._xtermGraphicsAttributes(params)),
// render hook
terminal.onRender(range => this._storage?.render(range)),
/**
* reset handlers covered:
* - DECSTR
* - RIS
* - Terminal.reset()
*/
terminal.parser.registerCsiHandler({ intermediates: '!', final: 'p' }, () => this.reset()),
terminal.parser.registerEscHandler({ final: 'c' }, () => this.reset()),
terminal._core._inputHandler.onRequestReset(() => this.reset()),
// wipe canvas and delete alternate images on buffer switch
terminal.buffer.onBufferChange(() => this._storage?.wipeAlternate()),
// extend images to the right on resize
terminal.onResize(metrics => this._storage?.viewportResize(metrics))
);
// SIXEL handler
if (this._opts.sixelSupport) {
const sixelHandler = new SixelHandler(this._opts, this._storage!, terminal);
this._handlers.set('sixel', sixelHandler);
this._disposeLater(
terminal._core._inputHandler._parser.registerDcsHandler({ final: 'q' }, sixelHandler)
);
}
// iTerm IIP handler
if (this._opts.iipSupport) {
const iipHandler = new IIPHandler(this._opts, this._renderer!, this._storage!, terminal);
this._handlers.set('iip', iipHandler);
this._disposeLater(
terminal._core._inputHandler._parser.registerOscHandler(1337, iipHandler)
);
}
}
// Note: storageLimit is skipped here to not intoduce a surprising side effect.
public reset(): boolean {
// reset options customizable by sequences to defaults
this._opts.sixelScrolling = this._defaultOpts.sixelScrolling;
this._opts.sixelPaletteLimit = this._defaultOpts.sixelPaletteLimit;
// also clear image storage
this._storage?.reset();
// reset protocol handlers
for (const handler of this._handlers.values()) {
handler.reset();
}
return false;
}
public get storageLimit(): number {
return this._storage?.getLimit() || -1;
}
public set storageLimit(limit: number) {
this._storage?.setLimit(limit);
this._opts.storageLimit = limit;
}
public get storageUsage(): number {
if (this._storage) {
return this._storage.getUsage();
}
return -1;
}
public get showPlaceholder(): boolean {
return this._opts.showPlaceholder;
}
public set showPlaceholder(value: boolean) {
this._opts.showPlaceholder = value;
this._renderer?.showPlaceholder(value);
}
public getImageAtBufferCell(x: number, y: number): HTMLCanvasElement | undefined {
return this._storage?.getImageAtBufferCell(x, y);
}
public extractTileAtBufferCell(x: number, y: number): HTMLCanvasElement | undefined {
return this._storage?.extractTileAtBufferCell(x, y);
}
private _report(s: string): void {
this._terminal?._core.coreService.triggerDataEvent(s);
}
private _decset(params: (number | number[])[]): boolean {
for (let i = 0; i < params.length; ++i) {
switch (params[i]) {
case 80:
this._opts.sixelScrolling = false;
break;
}
}
return false;
}
private _decrst(params: (number | number[])[]): boolean {
for (let i = 0; i < params.length; ++i) {
switch (params[i]) {
case 80:
this._opts.sixelScrolling = true;
break;
}
}
return false;
}
// overload DA to return something more appropriate
private _da1(params: (number | number[])[]): boolean {
if (params[0]) {
return true;
}
// reported features:
// 62 - VT220
// 4 - SIXEL support
// 9 - charsets
// 22 - ANSI colors
if (this._opts.sixelSupport) {
this._report(`\x1b[?62;4;9;22c`);
return true;
}
return false;
}
/**
* Implementation of xterm's graphics attribute sequence.
*
* Supported features:
* - read/change palette limits (max 4096 by sixel lib)
* - read SIXEL canvas geometry (reports current window canvas or
* squared pixelLimit if canvas > pixel limit)
*
* Everything else is deactivated.
*/
private _xtermGraphicsAttributes(params: (number | number[])[]): boolean {
if (params.length < 2) {
return true;
}
if (params[0] === GaItem.COLORS) {
switch (params[1]) {
case GaAction.READ:
this._report(`\x1b[?${params[0]};${GaStatus.SUCCESS};${this._opts.sixelPaletteLimit}S`);
return true;
case GaAction.SET_DEFAULT:
this._opts.sixelPaletteLimit = this._defaultOpts.sixelPaletteLimit;
this._report(`\x1b[?${params[0]};${GaStatus.SUCCESS};${this._opts.sixelPaletteLimit}S`);
// also reset protocol handlers for now
for (const handler of this._handlers.values()) {
handler.reset();
}
return true;
case GaAction.SET:
if (params.length > 2 && !(params[2] instanceof Array) && params[2] <= MAX_SIXEL_PALETTE_SIZE) {
this._opts.sixelPaletteLimit = params[2];
this._report(`\x1b[?${params[0]};${GaStatus.SUCCESS};${this._opts.sixelPaletteLimit}S`);
} else {
this._report(`\x1b[?${params[0]};${GaStatus.ACTION_ERROR}S`);
}
return true;
case GaAction.READ_MAX:
this._report(`\x1b[?${params[0]};${GaStatus.SUCCESS};${MAX_SIXEL_PALETTE_SIZE}S`);
return true;
default:
this._report(`\x1b[?${params[0]};${GaStatus.ACTION_ERROR}S`);
return true;
}
}
if (params[0] === GaItem.SIXEL_GEO) {
switch (params[1]) {
// we only implement read and read_max here
case GaAction.READ:
let width = this._renderer?.dimensions?.css.canvas.width;
let height = this._renderer?.dimensions?.css.canvas.height;
if (!width || !height) {
// for some reason we have no working image renderer
// --> fallback to default cell size
const cellSize = CELL_SIZE_DEFAULT;
width = (this._terminal?.cols || 80) * cellSize.width;
height = (this._terminal?.rows || 24) * cellSize.height;
}
if (width * height < this._opts.pixelLimit) {
this._report(`\x1b[?${params[0]};${GaStatus.SUCCESS};${width.toFixed(0)};${height.toFixed(0)}S`);
} else {
// if we overflow pixelLimit report that squared instead
const x = Math.floor(Math.sqrt(this._opts.pixelLimit));
this._report(`\x1b[?${params[0]};${GaStatus.SUCCESS};${x};${x}S`);
}
return true;
case GaAction.READ_MAX:
// read_max returns pixelLimit as square area
const x = Math.floor(Math.sqrt(this._opts.pixelLimit));
this._report(`\x1b[?${params[0]};${GaStatus.SUCCESS};${x};${x}S`);
return true;
default:
this._report(`\x1b[?${params[0]};${GaStatus.ACTION_ERROR}S`);
return true;
}
}
// exit with error on ReGIS or any other requests
this._report(`\x1b[?${params[0]};${GaStatus.ITEM_ERROR}S`);
return true;
}
}

Some files were not shown because too many files have changed in this diff Show More