Skip to content

Commit b3903f6

Browse files
committed
merge with devel
2 parents a2d769d + 39dbfe3 commit b3903f6

23 files changed

+615
-293
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
## 2.34.0
2+
### Features
3+
* add `term::get_mask` method [#785](https://github.com/jcubic/jquery.terminal/issues/785)
4+
* add `onReady` event to `term::read` [#779](https://github.com/jcubic/jquery.terminal/issues/779)
5+
* improve performance of typing animation
6+
* add `prefers-reduced-motion` into main CSS
7+
* pause terminal when images are loading [#802](https://github.com/jcubic/jquery.terminal/issues/802)
8+
* allow disable scroll to bottom on resume [#800](https://github.com/jcubic/jquery.terminal/issues/800)
9+
### Bugfix
10+
* fix line wrapping of cmd when using echo: newline [#773](https://github.com/jcubic/jquery.terminal/issues/773)
11+
* fix text selection on echo without newline text
12+
* fix rejected promises from echo [#790](https://github.com/jcubic/jquery.terminal/issues/790)
13+
* improve TypeScript types for typing animation [#794](https://github.com/jcubic/jquery.terminal/issues/794)
14+
* add missing mousewheel typing animation [#795](https://github.com/jcubic/jquery.terminal/issues/795)
15+
* fix iterate formatting over closing bracket [#792](https://github.com/jcubic/jquery.terminal/issues/792)
16+
* fix resolving promise from echo typing animation when previous command was async [#797](https://github.com/jcubic/jquery.terminal/issues/797)
17+
* fix double exception in terminal::destroy
18+
* fix double call to finalize function when echo DOM nodes
19+
* fix $.terminal.substring [#792](https://github.com/jcubic/jquery.terminal/issues/792)
20+
121
## 2.33.3
222
### Bugfix
323
* fix newline in minified js file [#780](https://github.com/jcubic/jquery.terminal/issues/780)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2011-2021 Jakub Jankiewicz
3+
Copyright (c) 2011-2022 Jakub T. Jankiewicz
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ UPDATE_CONTRIBUTORS=1
2424

2525
.PHONY: coverage test coveralls lint.src eslint skipped_tests jsonlint publish lint tscheck publish-guthub emoji
2626

27-
ALL: Makefile .$(VERSION) terminal.jquery.json bower.json package.json js/jquery.terminal-$(VERSION).js js/jquery.terminal.js js/jquery.terminal-$(VERSION).min.js js/jquery.terminal.min.js js/jquery.terminal.min.js.map css/jquery.terminal-$(VERSION).css css/jquery.terminal-$(VERSION).min.css css/jquery.terminal.min.css css/jquery.terminal.min.css.map css/jquery.terminal.css README.md import.html js/terminal.widget.js css/emoji.css
27+
ALL: Makefile .$(VERSION) terminal.jquery.json bower.json package.json assets/ascii_art.svg js/jquery.terminal-$(VERSION).js js/jquery.terminal.js js/jquery.terminal-$(VERSION).min.js js/jquery.terminal.min.js js/jquery.terminal.min.js.map css/jquery.terminal-$(VERSION).css css/jquery.terminal-$(VERSION).min.css css/jquery.terminal.min.css css/jquery.terminal.min.css.map css/jquery.terminal.css README.md import.html js/terminal.widget.js css/emoji.css
2828

2929
bower.json: templates/bower.in .$(VERSION)
3030
$(SED) -e "s/{{VER}}/$(VERSION)/g" templates/bower.in > bower.json
@@ -87,6 +87,9 @@ emoji:
8787
test:
8888
$(JEST) --coverage --env=jsdom --testMatch '**/__tests__/*.spec.js'
8989

90+
assets/ascii_art.svg: templates/ascii_art.svg .$(VERSION)
91+
$(SED) -e "s/{{VER}}/$(VERSION)/g" templates/ascii_art.svg > assets/ascii_art.svg
92+
9093
test-accept-snapshots:
9194
$(JEST) --coverage --env=jsdom --updateSnapshot --testMatch '**/__tests__/*.spec.js'
9295

README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
```
2-
_______ ________ __
3-
/ / _ /_ ____________ _/__ ___/______________ _____ / /
4-
__ / / // / // / _ / _/ // / / / _ / _/ / / \/ / _ \/ /
5-
/ / / // / // / ___/ // // / / / ___/ // / / / / /\ / // / /__
6-
\___/____ \\__/____/_/ \__ / /_/____/_//_/_/_/_/_/ \/\__\_\___/
7-
\/ /____/ version 2.33.3
8-
```
1+
<h1 align="center">
2+
<img src="https://github.com/jcubic/jquery.terminal/blob/devel/assets/ascii_art.svg?raw=true&ver=DEV"
3+
alt="ASCII Art that represent text jQuery Terminal - JavaScript Library for Web Based Terminal Emulators" />
4+
</h1>
95

106
[JavaScript Library for Web Based Terminal Emulators](https://terminal.jcubic.pl)
117

12-
[![npm](https://img.shields.io/badge/npm-2.33.3-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
13-
![bower](https://img.shields.io/badge/bower-2.33.3-yellow.svg)
14-
[![Build and test](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml/badge.svg?branch=master&event=push)](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml)
15-
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=master&d6690de257147887b9c38f73c9cdd577)](https://coveralls.io/github/jcubic/jquery.terminal?branch=master)
8+
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
9+
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
10+
[![Build and test](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml)
11+
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&70475733b1e1a70ed53740d9ddefb0a5)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
1612
![downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
1713
[![Paid Support](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded)](https://www.jsdelivr.com/package/npm/jquery.terminal)
1814
[![](https://img.shields.io/badge/paid-support-354465.svg)](https://support.jcubic.pl/)
@@ -91,7 +87,7 @@ You can test current version at this URL:
9187

9288
or if it doesn't use latest version (because of jsDelivr cache) you can force it with this URL:
9389

94-
* [https://jcubic.github.io/jquery.terminal/?ver=2.33.3](https://jcubic.github.io/jquery.terminal/?ver=2.33.3)
90+
* [https://jcubic.github.io/jquery.terminal/?ver=DEV](https://jcubic.github.io/jquery.terminal/?ver=DEV)
9591

9692
And development version using:
9793

@@ -109,20 +105,20 @@ Include jQuery library, you can use cdn from https://jquery.com/download/
109105

110106
```
111107

112-
Then include js/jquery.terminal-2.33.3.min.js and css/jquery.terminal-2.33.3.min.css
108+
Then include js/jquery.terminal-DEV.min.js and css/jquery.terminal-DEV.min.css
113109

114110
You can grab the files from CDN:
115111

116112
```html
117-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.33.3/js/jquery.terminal.min.js"></script>
118-
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/2.33.3/css/jquery.terminal.min.css" rel="stylesheet"/>
113+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/DEV/js/jquery.terminal.min.js"></script>
114+
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.terminal/DEV/css/jquery.terminal.min.css" rel="stylesheet"/>
119115
```
120116

121117
or
122118

123119
```html
124-
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal@2.33.3/js/jquery.terminal.min.js"></script>
125-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal@2.33.3/css/jquery.terminal.min.css">
120+
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal@DEV/js/jquery.terminal.min.js"></script>
121+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal@DEV/css/jquery.terminal.min.css">
126122
```
127123

128124
If you always want latest version, you can get it from [unpkg](https://unpkg.com/) without specifying version,
@@ -355,11 +351,17 @@ Personal thanks:
355351
* [T.J. Crowder](https://stackoverflow.com/users/157247/t-j-crowder) for helping with tracking_replace on [StackOveflow](https://stackoverflow.com/a/46756077/387194)
356352
* [@jerch](https://github.com/jerch) for helping with ANSI Parsing
357353

354+
Also thanks to:
355+
356+
[![BrowserStack](https://user-images.githubusercontent.com/587740/39730261-9c65c4d8-522e-11e8-9f12-16b349377a35.png)](http://browserstack.com/)
357+
358+
for cross-device testing opportunity.
359+
358360
### Paid Support
359361
You can request paid support, you can find details at [support.jcubic.pl](https://support.jcubic.pl/).
360362

361363
### License
362364

363365
Licensed under [MIT](http://opensource.org/licenses/MIT) license
364366

365-
Copyright (c) 2011-2021 [Jakub T. Jankiewicz](https://jcubic.pl/me)
367+
Copyright (c) 2011-2022 [Jakub T. Jankiewicz](https://jcubic.pl/me)

__tests__/terminal.spec.js

Lines changed: 59 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* \/ /____/ version {{VER}}
88
*
99
* This file is part of jQuery Terminal. http://terminal.jcubic.pl
10-
* Copyright (c) 2010-2018 Jakub Jankiewicz <http://jcubic.pl/me>
10+
* Copyright (c) 2010-2022 Jakub T. Jankiewicz <http://jcubic.pl/me>
1111
* Released under the MIT license
1212
*
1313
* Image Credit: Author Peter Hamer, source Wikipedia
@@ -251,6 +251,9 @@ require('../js/pipe')(global.$);
251251
require('../js/autocomplete_menu')(global.$);
252252
require('../js/less')(global.$);
253253

254+
// this is needed for testing less plugin
255+
global.$.terminal.defaults.imagePause = false;
256+
254257
var fs = require('fs');
255258
var util = require('util');
256259
fs.readFileAsync = util.promisify(fs.readFile);
@@ -678,6 +681,18 @@ describe('Terminal utils', function() {
678681
expect($.terminal.substring(input, spec[0], 200)).toEqual(spec[1]);
679682
});
680683
});
684+
it('should partition the string with brackets outside of formatting', function() {
685+
// issue #792
686+
var text = "[this] is some [[random]] text [[;red;]hello], [[world]]";
687+
var len = $.terminal.length(text);
688+
var result = [];
689+
for (var i = 0; i < len; ++i) {
690+
result.push($.terminal.substring(text, i,i+1));
691+
}
692+
for (let str of result) {
693+
expect($.terminal.length(str)).toEqual(1);
694+
}
695+
});
681696
it('should return substring when input starts from normal text', function() {
682697
var input = 'Lorem Ipsum [[;;]Dolor]';
683698
expect($.terminal.substring(input, 10, 200)).toEqual('m [[;;]Dolor]');
@@ -5075,6 +5090,14 @@ describe('Terminal plugin', function() {
50755090
await term.insert('_world', { typing: true, delay: 0});
50765091
expect(term.get_command()).toEqual('hello_world');
50775092
});
5093+
// issue #797
5094+
it('should resolve animation after async command', async () => {
5095+
term.echo(delay(0, () => "A"));
5096+
const fn = jest.fn();
5097+
term.echo("B", { typing: true, delay: 0 }).then(fn);
5098+
await delay(200);
5099+
expect(fn).toHaveBeenCalled();
5100+
});
50785101
});
50795102

50805103
describe('exec', function() {
@@ -5716,72 +5739,68 @@ describe('Terminal plugin', function() {
57165739
});
57175740
it('should flush correctly with newline : false', function(){
57185741
var term = $('<div/>').terminal($.noop, {
5719-
greetings : "greet"
5742+
greetings : 'greet'
57205743
});
5721-
var cmd = term.find(".cmd");
5744+
var cmd = term.find('.cmd');
57225745

5723-
expect(term.find(".partial")[0]).toEqual(undefined);
5724-
expect(term.find("[data-index='0']").text()).toEqual("greet");
5746+
expect(term.find('.partial')[0]).toEqual(undefined);
5747+
expect(term.find('[data-index="0"]').text()).toEqual('greet');
57255748

57265749
function getLastLineRect(partial){
57275750
let child = partial[0].lastElementChild;
5728-
child.style.width = "";
5751+
child.style.width = '';
57295752
let rect = child.getBoundingClientRect();
5730-
child.style.width = "100%";
5753+
child.style.width = '100%';
57315754
return rect;
57325755
}
57335756

5734-
term.echo("###", {newline : false});
5757+
term.echo('###', {newline : false});
57355758

5736-
var prompt = term.find(".cmd-prompt");
5737-
var partial = term.find(".partial");
5759+
var prompt = term.find('.cmd-prompt');
5760+
var partial = term.find('.partial');
57385761
var partial_children = partial.children();
57395762
var last_line_rect = getLastLineRect(partial);
5740-
expect(partial.attr("data-index")).toEqual("1");
5763+
expect(partial.attr('data-index')).toEqual('1');
57415764
expect(partial_children.length).toEqual(1);
5742-
expect(cmd.css("top")).toEqual(`${-last_line_rect.height}px`);
5743-
expect(prompt[0].style.marginLeft).toEqual(`${last_line_rect.width}px`);
5744-
expect(partial_children.first().text()).toEqual("###");
5765+
expect(cmd.css('top')).toEqual(`${-last_line_rect.height}px`);
5766+
expect(partial_children.first().text()).toEqual('###');
57455767

5746-
term.echo("aaa\nbbb\nccc", {newline : false});
5768+
term.echo('aaa\nbbb\nccc', {newline : false});
57475769

5748-
prompt = term.find(".cmd-prompt");
5749-
partial = term.find(".partial");
5770+
prompt = term.find('.cmd-prompt');
5771+
partial = term.find('.partial');
57505772
partial_children = partial.children();
57515773
last_line_rect = getLastLineRect(partial);
5752-
expect(partial.attr("data-index")).toEqual("1");
5774+
expect(partial.attr('data-index')).toEqual('1');
57535775
expect(partial_children.length).toEqual(3);
5754-
expect(cmd.css("top")).toEqual(`${-last_line_rect.height}px`);
5755-
expect(prompt[0].style.marginLeft).toEqual(`${last_line_rect.width}px`);
5756-
expect(partial_children.eq(0).text()).toEqual("###aaa");
5757-
expect(partial_children.eq(1).text()).toEqual("bbb");
5758-
expect(partial_children.eq(2).text()).toEqual("ccc");
5776+
expect(cmd.css('top')).toEqual(`${-last_line_rect.height}px`);
5777+
expect(partial_children.eq(0).text()).toEqual('###aaa');
5778+
expect(partial_children.eq(1).text()).toEqual('bbb');
5779+
expect(partial_children.eq(2).text()).toEqual('ccc');
57595780
term.refresh();
57605781

5761-
prompt = term.find(".cmd-prompt");
5762-
partial = term.find(".partial");
5782+
prompt = term.find('.cmd-prompt');
5783+
partial = term.find('.partial');
57635784
partial_children = partial.children();
57645785
last_line_rect = getLastLineRect(partial);
5765-
expect(partial.attr("data-index")).toEqual("1");
5786+
expect(partial.attr('data-index')).toEqual('1');
57665787
expect(partial_children.length).toEqual(3);
5767-
expect(cmd.css("top")).toEqual(`${-last_line_rect.height}px`);
5768-
expect(prompt[0].style.marginLeft).toEqual(`${last_line_rect.width}px`);
5769-
expect(partial_children.eq(0).text()).toEqual("###aaa");
5770-
expect(partial_children.eq(1).text()).toEqual("bbb");
5771-
expect(partial_children.eq(2).text()).toEqual("ccc");
5788+
expect(cmd.css('top')).toEqual(`${-last_line_rect.height}px`);
5789+
expect(partial_children.eq(0).text()).toEqual('###aaa');
5790+
expect(partial_children.eq(1).text()).toEqual('bbb');
5791+
expect(partial_children.eq(2).text()).toEqual('ccc');
57725792

5773-
enter(term, "!!!");
5793+
enter(term, '!!!');
57745794

5775-
prompt = term.find(".cmd-prompt");
5776-
expect(cmd.css("top")).toEqual(`0px`);
5777-
expect(prompt[0].style.marginLeft).toEqual(`0px`);
5778-
expect(term.find("[data-index='1']").length).toEqual(1);
5779-
expect(term.find("[data-index='1']").children().last().text()).toEqual(nbsp("ccc> !!!"));
5780-
expect(term.find(".partial")[0]).toEqual(undefined);
5795+
prompt = term.find('.cmd-prompt');
5796+
expect(cmd.css('top')).toEqual('');
5797+
expect(term.find('[data-index="1"]').length).toEqual(1);
5798+
expect(term.find('[data-index="1"]').children().last().text()).toEqual(nbsp('ccc> !!!'));
5799+
expect(term.find('.partial')[0]).toEqual(undefined);
57815800

57825801
term.refresh();
5783-
expect(term.find("[data-index='1']").length).toEqual(1);
5784-
expect(term.find("[data-index='1']").children().last().text()).toEqual(nbsp("ccc> !!!"));
5802+
expect(term.find('[data-index="1"]').length).toEqual(1);
5803+
expect(term.find('[data-index="1"]').children().last().text()).toEqual(nbsp('ccc> !!!'));
57855804
});
57865805
});
57875806
describe('output_buffer', function() {

0 commit comments

Comments
 (0)