Skip to content

Commit

Permalink
fix scroll to bottom on echo image #716
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Dec 13, 2021
1 parent 10c4eee commit 6b451ed
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 15 deletions.
16 changes: 12 additions & 4 deletions js/jquery.terminal-2.29.5.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Mon, 06 Dec 2021 21:26:30 +0000
* Date: Mon, 13 Dec 2021 11:24:39 +0000
*/
/* global define, Map */
/* eslint-disable */
Expand Down Expand Up @@ -5102,7 +5102,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Mon, 06 Dec 2021 21:26:30 +0000',
date: 'Mon, 13 Dec 2021 11:24:39 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -9874,6 +9874,7 @@
when_ready(function ready() {
try {
var bottom = self.is_bottom();
var scroll = (settings.scrollOnEcho && options.scroll) || bottom;
var wrapper;
// print all lines
var first = true;
Expand All @@ -9896,6 +9897,12 @@
wrapper = partial;
}
} else if (is_function(data.finalize)) {
if (scroll) {
wrapper.find('img').on('load', function() {
console.log('bottom');
self.scroll_to_bottom();
});
}
// this is finalize function from echo
if (options.update) {
lines.update_snapshot(data.index, snapshot);
Expand Down Expand Up @@ -9998,7 +10005,7 @@
cmd_cursor.show();
}, 0);
}, 0);
if ((settings.scrollOnEcho && options.scroll) || bottom) {
if (scroll) {
self.scroll_to_bottom();
}
} catch (e1) {
Expand Down Expand Up @@ -10128,7 +10135,8 @@
if (is_function(finalize)) {
finalize.call(self, div);
}
div.find('img').each(function() {
var $images = div.find('img');
$images.each(function() {
var self = $(this);
var img = new Image();
img.onerror = function() {
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.29.5.min.js

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions js/jquery.terminal-src.js
Expand Up @@ -9874,6 +9874,7 @@
when_ready(function ready() {
try {
var bottom = self.is_bottom();
var scroll = (settings.scrollOnEcho && options.scroll) || bottom;
var wrapper;
// print all lines
var first = true;
Expand All @@ -9896,6 +9897,12 @@
wrapper = partial;
}
} else if (is_function(data.finalize)) {
if (scroll) {
wrapper.find('img').on('load', function() {
console.log('bottom');
self.scroll_to_bottom();
});
}
// this is finalize function from echo
if (options.update) {
lines.update_snapshot(data.index, snapshot);
Expand Down Expand Up @@ -9998,7 +10005,7 @@
cmd_cursor.show();
}, 0);
}, 0);
if ((settings.scrollOnEcho && options.scroll) || bottom) {
if (scroll) {
self.scroll_to_bottom();
}
} catch (e1) {
Expand Down Expand Up @@ -10128,7 +10135,8 @@
if (is_function(finalize)) {
finalize.call(self, div);
}
div.find('img').each(function() {
var $images = div.find('img');
$images.each(function() {
var self = $(this);
var img = new Image();
img.onerror = function() {
Expand Down
16 changes: 12 additions & 4 deletions js/jquery.terminal.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Mon, 06 Dec 2021 21:26:30 +0000
* Date: Mon, 13 Dec 2021 11:24:39 +0000
*/
/* global define, Map */
/* eslint-disable */
Expand Down Expand Up @@ -5102,7 +5102,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Mon, 06 Dec 2021 21:26:30 +0000',
date: 'Mon, 13 Dec 2021 11:24:39 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -9874,6 +9874,7 @@
when_ready(function ready() {
try {
var bottom = self.is_bottom();
var scroll = (settings.scrollOnEcho && options.scroll) || bottom;
var wrapper;
// print all lines
var first = true;
Expand All @@ -9896,6 +9897,12 @@
wrapper = partial;
}
} else if (is_function(data.finalize)) {
if (scroll) {
wrapper.find('img').on('load', function() {
console.log('bottom');
self.scroll_to_bottom();
});
}
// this is finalize function from echo
if (options.update) {
lines.update_snapshot(data.index, snapshot);
Expand Down Expand Up @@ -9998,7 +10005,7 @@
cmd_cursor.show();
}, 0);
}, 0);
if ((settings.scrollOnEcho && options.scroll) || bottom) {
if (scroll) {
self.scroll_to_bottom();
}
} catch (e1) {
Expand Down Expand Up @@ -10128,7 +10135,8 @@
if (is_function(finalize)) {
finalize.call(self, div);
}
div.find('img').each(function() {
var $images = div.find('img');
$images.each(function() {
var self = $(this);
var img = new Image();
img.onerror = function() {
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 6b451ed

Please sign in to comment.