Skip to content

Commit 97e28da

Browse files
committed
fix deepscan issues #842
1 parent 441e7a2 commit 97e28da

File tree

8 files changed

+42
-54
lines changed

8 files changed

+42
-54
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
99
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
1010
[![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&e31addf398172b261ad412bde3188469)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
11+
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&01c4c1ced7480107e0acd1f20fd8c4c3)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
1212
![NPM Downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
1313
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded&n=1)](https://www.jsdelivr.com/package/npm/jquery.terminal)
1414
[![Paid Support](https://img.shields.io/badge/paid-support-354465.svg)](https://support.jcubic.pl/)

__tests__/terminal.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3719,7 +3719,7 @@ describe('Terminal plugin', function() {
37193719
unobserve: function() {
37203720
for (var i = i_callback.length; --i;) {
37213721
if (i_callback[i] === callback) {
3722-
i_callback.slice(i, 1);
3722+
i_callback.splice(i, 1);
37233723
break;
37243724
}
37253725
}
@@ -5131,7 +5131,6 @@ describe('Terminal plugin', function() {
51315131
}
51325132
})();
51335133
});
5134-
term.destroy().remove();
51355134
});
51365135
it('should complete when text have escaped quotes', function() {
51375136
term = $('<div/>').appendTo('body').terminal({}, {

bin/convert.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ function format_lines(str, len) {
117117
ansiArt: true
118118
}
119119
});
120-
var lines;
121120
if (len) {
122121
var lines = $.terminal.split_equal(str, len);
123122
// unix formatting don't handle \r\n at the end

js/jquery.terminal-src.js

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,9 +1269,9 @@
12691269
var color_re = /^(?:#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/i;
12701270
var url_re = /(\b(?:file|ftp|https?|blog:https?):\/\/(?:[^/\s]+\.[^/\s.]+)(?:\/[^\s]*)?(?:#[^\s]*)?)/gi;
12711271
var url_nf_re = /\b(?![^"\s[\]]*])(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&amp;))[^\s"'\\<>\][)])+)/gi;
1272-
var email_re = /((([^<>('")[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/g;
1272+
var email_re = /((([^<>('")[\]\\.,;:\s@]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/g;
12731273
var url_full_re = /^(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&amp;))[^\s"'<>\\\][)])+)$/gi;
1274-
var email_full_re = /^((([^<>('")[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))$/g;
1274+
var email_full_re = /^((([^<>('")[\]\\.,;:\s@]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))$/g;
12751275
var command_re = /((?:"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`|\/[^\/\\]*(?:\\[\S\s][^\/\\]*)*\/[gimsuy]*(?=\s|$)|(?:\\\s|\S))+)(?=\s|$)/gi;
12761276
var extended_command_re = /^\s*((terminal|cmd)::([a-z_]+)\(([\s\S]*)\))\s*$/;
12771277
var format_exec_split_re = /(\[\[(?:-?[@!gbiusor])*;[^\]]+\](?:\\[[\]]|[^\]])*\]|\[\[[\s\S]+?\]\])/;
@@ -3185,7 +3185,7 @@
31853185
}
31863186
}
31873187
} else {
3188-
array = split(prompt_marker + prompt + string, num_chars);
3188+
array = split(prompt_marker + prompt + string);
31893189
array[0] = array[0].replace(re, '');
31903190
}
31913191
// fix issue with cursor that was cut off #379
@@ -5878,7 +5878,7 @@
58785878
}
58795879
string = start_formatting + string.slice(start, end);
58805880
if (end_formatting) {
5881-
string = string.replace(/(\[\[^\]]+)?\]$/, '');
5881+
string = string.replace(/(\[\[[^\]]+)?\]$/, '');
58825882
string += ']';
58835883
}
58845884
return string;
@@ -6317,10 +6317,7 @@
63176317
var ret = formatter(input[0], options);
63186318
if (typeof ret === 'string') {
63196319
test_lengths(formatter, i - 1, ret, input[0]);
6320-
if (typeof ret === 'string') {
6321-
return [ret, options.position];
6322-
}
6323-
return input;
6320+
return [ret, options.position];
63246321
} else if (is_array(ret) && ret.length === 2) {
63256322
return ret;
63266323
} else {
@@ -7415,14 +7412,12 @@
74157412
'></div></div><div class="terminal-pixel"></div></div>')
74167413
.appendTo('body');
74177414
temp.addClass(term.attr('class')).attr('id', term.attr('id'));
7418-
if (term) {
7419-
var style = term.attr('style');
7420-
if (style) {
7421-
style = style.split(/\s*;\s*/).filter(function(s) {
7422-
return !s.match(/display\s*:\s*none/i);
7423-
}).join(';');
7424-
temp.attr('style', style);
7425-
}
7415+
var style = term.attr('style');
7416+
if (style) {
7417+
style = style.split(/\s*;\s*/).filter(function(s) {
7418+
return !s.match(/display\s*:\s*none/i);
7419+
}).join(';');
7420+
temp.attr('style', style);
74267421
}
74277422
var node = temp.find('.terminal-line');
74287423
result = {
@@ -11470,10 +11465,10 @@
1147011465
pos = scroller.prop('scrollTop');
1147111466
scroller.scrollTop(pos + amount);
1147211467
} else {
11473-
if (amount > scroller.prop('scrollTop') && amount > 0) {
11474-
scroller.prop('scrollTop', 0);
11468+
if (amount > scroller.attr('scrollTop') && amount > 0) {
11469+
scroller.attr('scrollTop', 0);
1147511470
}
11476-
pos = scroller.prop('scrollTop');
11471+
pos = scroller.attr('scrollTop');
1147711472
scroller.scrollTop(pos + amount);
1147811473
}
1147911474
return self;

js/jquery.terminal.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*
4242
* broken image by Sophia Bai from the Noun Project (CC-BY)
4343
*
44-
* Date: Fri, 13 Dec 2024 15:04:35 +0000
44+
* Date: Sun, 05 Jan 2025 17:04:29 +0000
4545
*/
4646
/* global define, Map, BigInt */
4747
/* eslint-disable */
@@ -1269,9 +1269,9 @@
12691269
var color_re = /^(?:#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/i;
12701270
var url_re = /(\b(?:file|ftp|https?|blog:https?):\/\/(?:[^/\s]+\.[^/\s.]+)(?:\/[^\s]*)?(?:#[^\s]*)?)/gi;
12711271
var url_nf_re = /\b(?![^"\s[\]]*])(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&amp;))[^\s"'\\<>\][)])+)/gi;
1272-
var email_re = /((([^<>('")[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/g;
1272+
var email_re = /((([^<>('")[\]\\.,;:\s@]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/g;
12731273
var url_full_re = /^(https?:\/\/(?:(?:(?!&[^;]+;)|(?=&amp;))[^\s"'<>\\\][)])+)$/gi;
1274-
var email_full_re = /^((([^<>('")[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))$/g;
1274+
var email_full_re = /^((([^<>('")[\]\\.,;:\s@]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))$/g;
12751275
var command_re = /((?:"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'|`[^`\\]*(?:\\[\S\s][^`\\]*)*`|\/[^\/\\]*(?:\\[\S\s][^\/\\]*)*\/[gimsuy]*(?=\s|$)|(?:\\\s|\S))+)(?=\s|$)/gi;
12761276
var extended_command_re = /^\s*((terminal|cmd)::([a-z_]+)\(([\s\S]*)\))\s*$/;
12771277
var format_exec_split_re = /(\[\[(?:-?[@!gbiusor])*;[^\]]+\](?:\\[[\]]|[^\]])*\]|\[\[[\s\S]+?\]\])/;
@@ -3185,7 +3185,7 @@
31853185
}
31863186
}
31873187
} else {
3188-
array = split(prompt_marker + prompt + string, num_chars);
3188+
array = split(prompt_marker + prompt + string);
31893189
array[0] = array[0].replace(re, '');
31903190
}
31913191
// fix issue with cursor that was cut off #379
@@ -5407,7 +5407,7 @@
54075407
// -------------------------------------------------------------------------
54085408
$.terminal = {
54095409
version: 'DEV',
5410-
date: 'Fri, 13 Dec 2024 15:04:35 +0000',
5410+
date: 'Sun, 05 Jan 2025 17:04:29 +0000',
54115411
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
54125412
color_names: [
54135413
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
@@ -5878,7 +5878,7 @@
58785878
}
58795879
string = start_formatting + string.slice(start, end);
58805880
if (end_formatting) {
5881-
string = string.replace(/(\[\[^\]]+)?\]$/, '');
5881+
string = string.replace(/(\[\[[^\]]+)?\]$/, '');
58825882
string += ']';
58835883
}
58845884
return string;
@@ -6317,10 +6317,7 @@
63176317
var ret = formatter(input[0], options);
63186318
if (typeof ret === 'string') {
63196319
test_lengths(formatter, i - 1, ret, input[0]);
6320-
if (typeof ret === 'string') {
6321-
return [ret, options.position];
6322-
}
6323-
return input;
6320+
return [ret, options.position];
63246321
} else if (is_array(ret) && ret.length === 2) {
63256322
return ret;
63266323
} else {
@@ -7415,14 +7412,12 @@
74157412
'></div></div><div class="terminal-pixel"></div></div>')
74167413
.appendTo('body');
74177414
temp.addClass(term.attr('class')).attr('id', term.attr('id'));
7418-
if (term) {
7419-
var style = term.attr('style');
7420-
if (style) {
7421-
style = style.split(/\s*;\s*/).filter(function(s) {
7422-
return !s.match(/display\s*:\s*none/i);
7423-
}).join(';');
7424-
temp.attr('style', style);
7425-
}
7415+
var style = term.attr('style');
7416+
if (style) {
7417+
style = style.split(/\s*;\s*/).filter(function(s) {
7418+
return !s.match(/display\s*:\s*none/i);
7419+
}).join(';');
7420+
temp.attr('style', style);
74267421
}
74277422
var node = temp.find('.terminal-line');
74287423
result = {
@@ -11470,10 +11465,10 @@
1147011465
pos = scroller.prop('scrollTop');
1147111466
scroller.scrollTop(pos + amount);
1147211467
} else {
11473-
if (amount > scroller.prop('scrollTop') && amount > 0) {
11474-
scroller.prop('scrollTop', 0);
11468+
if (amount > scroller.attr('scrollTop') && amount > 0) {
11469+
scroller.attr('scrollTop', 0);
1147511470
}
11476-
pos = scroller.prop('scrollTop');
11471+
pos = scroller.attr('scrollTop');
1147711472
scroller.scrollTop(pos + amount);
1147811473
}
1147911474
return self;

js/jquery.terminal.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/jquery.terminal.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/prism.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,16 @@
8383
factory(root.jQuery, root.Prism);
8484
}
8585
})(function($, Prism) {
86-
var Token = Prism.Token;
86+
if (!$) {
87+
throw new Error('jQuery Not defined');
88+
}
89+
if (!$.terminal) {
90+
throw new Error('$.terminal is not defined');
91+
}
8792
if (typeof Prism === 'undefined') {
8893
throw new Error('PrismJS not defined');
8994
}
95+
var Token = Prism.Token;
9096
var _ = $.extend({}, Prism);
9197

9298
_.Token = function() {
@@ -140,12 +146,6 @@
140146
return '';
141147
}).join('\n');
142148
};
143-
if (!$) {
144-
throw new Error('jQuery Not defined');
145-
}
146-
if (!$.terminal) {
147-
throw new Error('$.terminal is not defined');
148-
}
149149
// we use 0x00 character so we know which one of the formatting came from prism
150150
// so we can escape the reset because we unescape original values, the values
151151
// need to be escape in cmd plugin so you can't type in formatting

0 commit comments

Comments
 (0)