Skip to content

Commit

Permalink
remove delay after finishing of typing animation #976
Browse files Browse the repository at this point in the history
This delay was causing of flashing of old prompt,
because the echo that happen when animation ends.
When the delay was removed the lines got removed
in same frame/event loop
  • Loading branch information
jcubic committed Oct 8, 2024
1 parent a032178 commit 412fe76
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 49 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* fix passing alt and class for image in less
* fix width of images in less when image is bigger than the terminal
* fix line-height of the lines to render less image slices properly
* fix flashing of old prompt after prompt animation [#976](https://github.com/jcubic/jquery.terminal/issues/976)

## 2.43.2
### Bugfix
Expand Down
42 changes: 20 additions & 22 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -9410,29 +9410,27 @@
}
if (stop) {
clearInterval(interval);
setTimeout(function() {
if (is_partial || options.newline === false) {
// HACK: fix sequence of animations #930
var idx = self.last_index();
var node = output.find('[data-index="' + idx + '"]');
options.finalize(node);
} else {
if (optimized) {
// clear old lines and make one full line
// so it can wrap when you resize
anim_lines.forEach(function(line) {
// ignore skipped lines
if (typeof line.index !== 'undefined') {
self.remove_line(line.index);
}
});
}
finish_typing_fn(message, prompt, options);
}
if (!was_animating) {
animating = false;
if (is_partial || options.newline === false) {
// HACK: fix sequence of animations #930
var idx = self.last_index();
var node = output.find('[data-index="' + idx + '"]');
options.finalize(node);
} else {
if (optimized) {
// clear old lines and make one full line
// so it can wrap when you resize
anim_lines.forEach(function(line) {
// ignore skipped lines
if (typeof line.index !== 'undefined') {
self.remove_line(line.index);
}
});
}
}, options.delay);
finish_typing_fn(message, prompt, options);
}
if (!was_animating) {
animating = false;
}
}
}, options.delay);
}
Expand Down
46 changes: 22 additions & 24 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: Thu, 03 Oct 2024 19:26:59 +0000
* Date: Tue, 08 Oct 2024 13:08:27 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5337,7 +5337,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Thu, 03 Oct 2024 19:26:59 +0000',
date: 'Tue, 08 Oct 2024 13:08:27 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -9410,29 +9410,27 @@
}
if (stop) {
clearInterval(interval);
setTimeout(function() {
if (is_partial || options.newline === false) {
// HACK: fix sequence of animations #930
var idx = self.last_index();
var node = output.find('[data-index="' + idx + '"]');
options.finalize(node);
} else {
if (optimized) {
// clear old lines and make one full line
// so it can wrap when you resize
anim_lines.forEach(function(line) {
// ignore skipped lines
if (typeof line.index !== 'undefined') {
self.remove_line(line.index);
}
});
}
finish_typing_fn(message, prompt, options);
}
if (!was_animating) {
animating = false;
if (is_partial || options.newline === false) {
// HACK: fix sequence of animations #930
var idx = self.last_index();
var node = output.find('[data-index="' + idx + '"]');
options.finalize(node);
} else {
if (optimized) {
// clear old lines and make one full line
// so it can wrap when you resize
anim_lines.forEach(function(line) {
// ignore skipped lines
if (typeof line.index !== 'undefined') {
self.remove_line(line.index);
}
});
}
}, options.delay);
finish_typing_fn(message, prompt, options);
}
if (!was_animating) {
animating = false;
}
}
}, options.delay);
}
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 412fe76

Please sign in to comment.