Skip to content

Commit

Permalink
fix running typing animation on empty terminal #950
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Jul 7, 2024
1 parent 76f42aa commit 83360d6
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
### Bugfix
* fix line wrapping when calling multiple echo `newline:false` [#952](https://github.com/jcubic/jquery.terminal/issues/952)
* fix cursor position when echo `newline:false` fill the line
* fix running typing animation on empty terminal [#950](https://github.com/jcubic/jquery.terminal/issues/950)

## 2.42.0
### Features
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
[![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)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&6ee880438b17f7a44dc1524dfb2b68c4)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&178e403b5b01bf07acdcbd8a0f64c147)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
![NPM Downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded&n=1)](https://www.jsdelivr.com/package/npm/jquery.terminal)
[![Paid Support](https://img.shields.io/badge/paid-support-354465.svg)](https://support.jcubic.pl/)
Expand Down
7 changes: 7 additions & 0 deletions __tests__/terminal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5287,6 +5287,13 @@ describe('Terminal plugin', function() {
await delay(500);
expect(fn).toHaveBeenCalled();
});
// #950
it('should animate on empty terminal', async () => {
term.clear();
await term.echo('hello', { typing: true, delay: 0 });
await delay(10);
expect(output(term)).toEqual(['hello']);
});
});

describe('exec', function() {
Expand Down
9 changes: 5 additions & 4 deletions js/jquery.terminal-2.42.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Sun, 07 Jul 2024 22:11:58 +0000
* Date: Sun, 07 Jul 2024 22:26:10 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -1798,10 +1798,11 @@
};
// -------------------------------------------------------------------------
OutputLines.prototype.has_newline = function() {
if (this._lines.length === 0) {
var line = this.last_line();
if (!line) {
return true;
}
return this.last_line()[1].newline;
return line[1].newline;
};
// -------------------------------------------------------------------------
// :: call when line is out of view when outputLimit is used
Expand Down Expand Up @@ -5311,7 +5312,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 07 Jul 2024 22:11:58 +0000',
date: 'Sun, 07 Jul 2024 22:26:10 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.42.0.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -1798,10 +1798,11 @@
};
// -------------------------------------------------------------------------
OutputLines.prototype.has_newline = function() {
if (this._lines.length === 0) {
var line = this.last_line();
if (!line) {
return true;
}
return this.last_line()[1].newline;
return line[1].newline;
};
// -------------------------------------------------------------------------
// :: call when line is out of view when outputLimit is used
Expand Down
9 changes: 5 additions & 4 deletions js/jquery.terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Sun, 07 Jul 2024 22:11:58 +0000
* Date: Sun, 07 Jul 2024 22:26:10 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -1798,10 +1798,11 @@
};
// -------------------------------------------------------------------------
OutputLines.prototype.has_newline = function() {
if (this._lines.length === 0) {
var line = this.last_line();
if (!line) {
return true;
}
return this.last_line()[1].newline;
return line[1].newline;
};
// -------------------------------------------------------------------------
// :: call when line is out of view when outputLimit is used
Expand Down Expand Up @@ -5311,7 +5312,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 07 Jul 2024 22:11:58 +0000',
date: 'Sun, 07 Jul 2024 22:26:10 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/jquery.terminal.min.js.map

Large diffs are not rendered by default.

0 comments on commit 83360d6

Please sign in to comment.