Skip to content

Commit

Permalink
update hash with proper array if hash is escaped
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Sep 27, 2021
1 parent 67c37fd commit ad50f83
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,6 +1,7 @@
## 2.29.3
### Bugfix
* fix echo raw interfering with echo without newline [#695](https://github.com/jcubic/jquery.terminal/issues/695)
* update hash with proper array if hash is escaped

## 2.29.2
### Bugfix
Expand Down
16 changes: 14 additions & 2 deletions js/jquery.terminal-2.29.2.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Tue, 21 Sep 2021 15:37:35 +0000
* Date: Mon, 27 Sep 2021 13:41:33 +0000
*/
/* global define, Map */
/* eslint-disable */
Expand Down Expand Up @@ -5065,7 +5065,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Tue, 21 Sep 2021 15:37:35 +0000',
date: 'Mon, 27 Sep 2021 13:41:33 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -8436,6 +8436,14 @@
return cursor.is_fully_in_viewport(self).then(scroll_to_view);
}
// ---------------------------------------------------------------------
function replace_hash(state) {
if (typeof history !== 'undefined' && history.replaceState) {
var new_hash = '#' + JSON.stringify(state);
var url = location.href.replace(/#.*$/, new_hash);
history.replaceState(null, '', url);
}
}
// ---------------------------------------------------------------------
function hashchange() {
if (fire_hash_change && settings.execHash) {
try {
Expand Down Expand Up @@ -11589,6 +11597,10 @@
var hash = location.hash.replace(/^#/, '');
// yes no var - local inside terminal
hash_commands = JSON.parse(decodeURIComponent(hash));
if (!hash.match(/\[/)) {
// fix the hash to look like array if it's not
replace_hash(hash_commands);
}
var i = 0;
(function recur() {
var spec = hash_commands[i++];
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.29.2.min.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions js/jquery.terminal-src.js
Expand Up @@ -8436,6 +8436,14 @@
return cursor.is_fully_in_viewport(self).then(scroll_to_view);
}
// ---------------------------------------------------------------------
function replace_hash(state) {
if (typeof history !== 'undefined' && history.replaceState) {
var new_hash = '#' + JSON.stringify(state);
var url = location.href.replace(/#.*$/, new_hash);
history.replaceState(null, '', url);
}
}
// ---------------------------------------------------------------------
function hashchange() {
if (fire_hash_change && settings.execHash) {
try {
Expand Down Expand Up @@ -11589,6 +11597,10 @@
var hash = location.hash.replace(/^#/, '');
// yes no var - local inside terminal
hash_commands = JSON.parse(decodeURIComponent(hash));
if (!hash.match(/\[/)) {
// fix the hash to look like array if it's not
replace_hash(hash_commands);
}
var i = 0;
(function recur() {
var spec = hash_commands[i++];
Expand Down
16 changes: 14 additions & 2 deletions js/jquery.terminal.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Tue, 21 Sep 2021 15:37:35 +0000
* Date: Mon, 27 Sep 2021 13:41:33 +0000
*/
/* global define, Map */
/* eslint-disable */
Expand Down Expand Up @@ -5065,7 +5065,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Tue, 21 Sep 2021 15:37:35 +0000',
date: 'Mon, 27 Sep 2021 13:41:33 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -8436,6 +8436,14 @@
return cursor.is_fully_in_viewport(self).then(scroll_to_view);
}
// ---------------------------------------------------------------------
function replace_hash(state) {
if (typeof history !== 'undefined' && history.replaceState) {
var new_hash = '#' + JSON.stringify(state);
var url = location.href.replace(/#.*$/, new_hash);
history.replaceState(null, '', url);
}
}
// ---------------------------------------------------------------------
function hashchange() {
if (fire_hash_change && settings.execHash) {
try {
Expand Down Expand Up @@ -11589,6 +11597,10 @@
var hash = location.hash.replace(/^#/, '');
// yes no var - local inside terminal
hash_commands = JSON.parse(decodeURIComponent(hash));
if (!hash.match(/\[/)) {
// fix the hash to look like array if it's not
replace_hash(hash_commands);
}
var i = 0;
(function recur() {
var spec = hash_commands[i++];
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 ad50f83

Please sign in to comment.