Skip to content

Commit cdb999c

Browse files
committed
fix default prompt when raw setting changes #1028
1 parent d3eed8a commit cdb999c

4 files changed

Lines changed: 37 additions & 25 deletions

File tree

js/jquery.terminal-src.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8781,9 +8781,22 @@
87818781
// :: Display user greetings or terminal signature
87828782
// ---------------------------------------------------------------------
87838783
function show_greetings() {
8784+
// raw option needs to be the same as when echo is called
8785+
// so change of the setting doesn't affect the signature
8786+
var raw_echo = raw('echo');
8787+
function render_signature() {
8788+
var result = self.signature();
8789+
if (raw_echo) {
8790+
result = result.split('\n').map(function(line) {
8791+
return $.terminal.format(links(line));
8792+
}).join('\n');
8793+
return '<pre class="terminal-signature">' + result + '</pre>';
8794+
}
8795+
return result;
8796+
}
87848797
if (settings.greetings === undefined) {
87858798
// signature have ascii art so it's not suite for screen readers
8786-
self.echo(self.signature, {finalize: a11y_hide, formatters: false});
8799+
self.echo(render_signature, {finalize: a11y_hide, formatters: false});
87878800
} else if (settings.greetings) {
87888801
if (is_string(settings.greetings)) {
87898802
self.echo(settings.greetings);
@@ -10754,15 +10767,8 @@
1075410767
// -------------------------------------------------------------
1075510768
// :: Return the terminal signature depending on the size of the terminal
1075610769
// -------------------------------------------------------------
10757-
signature: function() {
10758-
var result = signature();
10759-
if (raw('echo')) {
10760-
result = result.split('\n').map(function(line) {
10761-
return $.terminal.format(links(line));
10762-
}).join('\n');
10763-
return '<pre class="terminal-signature">' + result + '</pre>';
10764-
}
10765-
return result;
10770+
signature: function(raw) {
10771+
return signature();
1076610772
},
1076710773
// -------------------------------------------------------------
1076810774
// :: returns the number of rendered lines

js/jquery.terminal.js

Lines changed: 18 additions & 12 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: Sun, 04 Jan 2026 17:49:14 +0000
44+
* Date: Mon, 05 Jan 2026 11:15:40 +0000
4545
*/
4646
/* global define, Map, BigInt */
4747
/* eslint-disable */
@@ -5497,7 +5497,7 @@
54975497
// -------------------------------------------------------------------------
54985498
$.terminal = {
54995499
version: 'DEV',
5500-
date: 'Sun, 04 Jan 2026 17:49:14 +0000',
5500+
date: 'Mon, 05 Jan 2026 11:15:40 +0000',
55015501
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
55025502
color_names: [
55035503
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
@@ -8781,9 +8781,22 @@
87818781
// :: Display user greetings or terminal signature
87828782
// ---------------------------------------------------------------------
87838783
function show_greetings() {
8784+
// raw option needs to be the same as when echo is called
8785+
// so change of the setting doesn't affect the signature
8786+
var raw_echo = raw('echo');
8787+
function render_signature() {
8788+
var result = self.signature();
8789+
if (raw_echo) {
8790+
result = result.split('\n').map(function(line) {
8791+
return $.terminal.format(links(line));
8792+
}).join('\n');
8793+
return '<pre class="terminal-signature">' + result + '</pre>';
8794+
}
8795+
return result;
8796+
}
87848797
if (settings.greetings === undefined) {
87858798
// signature have ascii art so it's not suite for screen readers
8786-
self.echo(self.signature, {finalize: a11y_hide, formatters: false});
8799+
self.echo(render_signature, {finalize: a11y_hide, formatters: false});
87878800
} else if (settings.greetings) {
87888801
if (is_string(settings.greetings)) {
87898802
self.echo(settings.greetings);
@@ -10754,15 +10767,8 @@
1075410767
// -------------------------------------------------------------
1075510768
// :: Return the terminal signature depending on the size of the terminal
1075610769
// -------------------------------------------------------------
10757-
signature: function() {
10758-
var result = signature();
10759-
if (raw('echo')) {
10760-
result = result.split('\n').map(function(line) {
10761-
return $.terminal.format(links(line));
10762-
}).join('\n');
10763-
return '<pre class="terminal-signature">' + result + '</pre>';
10764-
}
10765-
return result;
10770+
signature: function(raw) {
10771+
return signature();
1076610772
},
1076710773
// -------------------------------------------------------------
1076810774
// :: returns the number of rendered lines

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.

0 commit comments

Comments
 (0)