Skip to content

Commit de7f7a3

Browse files
committed
fix(blessed): use hex escapes for Node 24 strict-mode compatibility
Node 24 rejects octal escape sequences in strict mode, so the vendored blessed lib/tput.js ('\200', '\016', '\017') threw a SyntaxError on startup and the CLI could not run on Node 24. Extend the blessed patch to use the byte-equivalent hex escapes ('\x80', '\x0e', '\x0f').
1 parent 77bce16 commit de7f7a3

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

patches/blessed@0.1.81.patch

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ index 0b1e56fadcf60719ca2e5231447ad2f8ace44bda..1494b715fb8f2143505bb2b5cea053d8
5252

5353
Program.prototype.bel =
5454
diff --git a/lib/tput.js b/lib/tput.js
55-
index 2a57f58b08e797e9751983eef917c127481770d5..aec81d28014cd7b9527d114dd0e9530acf1535ab 100644
55+
index 2a57f58b08e797e9751983eef917c127481770d5..ddfb9b88f64829ac0db9da4a200d874a7a88b0bc 100644
5656
--- a/lib/tput.js
5757
+++ b/lib/tput.js
5858
@@ -366,7 +366,7 @@ Tput.prototype.parseTerminfo = function(data, file) {
@@ -91,6 +91,15 @@ index 2a57f58b08e797e9751983eef917c127481770d5..aec81d28014cd7b9527d114dd0e9530a
9191
_strings.push(-1);
9292
} else {
9393
_strings.push((data[i + 1] << 8) | data[i]);
94+
@@ -884,7 +884,7 @@ Tput.prototype._compile = function(info, key, str) {
95+
ch = ':';
96+
break;
97+
case '0':
98+
- ch = '\200';
99+
+ ch = '\x80';
100+
break;
101+
case 'a':
102+
ch = '\x07';
94103
@@ -926,7 +926,7 @@ Tput.prototype._compile = function(info, key, str) {
95104
echo('sprintf("'+ cap[0].replace(':-', '-') + '", stack.pop())');
96105
} else if (cap[3] === 'c') {
@@ -100,6 +109,21 @@ index 2a57f58b08e797e9751983eef917c127481770d5..aec81d28014cd7b9527d114dd0e9530a
100109
} else {
101110
echo('stack.pop()');
102111
}
112+
@@ -2094,10 +2094,10 @@ Tput.prototype.detectBrokenACS = function(info) {
113+
&& process.env.TERMCAP
114+
&& ~process.env.TERMCAP.indexOf('screen')
115+
&& ~process.env.TERMCAP.indexOf('hhII00')) {
116+
- if (~info.strings.enter_alt_charset_mode.indexOf('\016')
117+
- || ~info.strings.enter_alt_charset_mode.indexOf('\017')
118+
- || ~info.strings.set_attributes.indexOf('\016')
119+
- || ~info.strings.set_attributes.indexOf('\017')) {
120+
+ if (~info.strings.enter_alt_charset_mode.indexOf('\x0e')
121+
+ || ~info.strings.enter_alt_charset_mode.indexOf('\x0f')
122+
+ || ~info.strings.set_attributes.indexOf('\x0e')
123+
+ || ~info.strings.set_attributes.indexOf('\x0f')) {
124+
return true;
125+
}
126+
}
103127
@@ -2276,7 +2276,7 @@ function sprintf(src) {
104128
break;
105129
case 'c': // char

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)