From 3fc86013449a9fc34acde36177e6a4df0eb19b12 Mon Sep 17 00:00:00 2001 From: Dillard Blom Date: Wed, 30 Sep 2026 02:25:13 +0200 Subject: [PATCH] Keep occ output brackets escaped through the formatters The overtyping and from_ansi formatters unescape brackets before they parse the text, so escaping them beforehand was not enough: literal brackets were still read as formatting. Enable unixFormattingEscapeBrackets so both formatters escape the text again after parsing. Verified in the browser: Symfony's "[alias]" in `occ list` stays in place, ANSI colors still work, and formatting in the output text (colors, links) is no longer applied. Bump the version to 0.4.4 so browsers load the new script. --- appinfo/info.xml | 2 +- js/index.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index d0aa006..f3a0c6f 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ Extended OCC Web OCC Commands in a web terminal - 0.4.3 + 0.4.4 agpl Dillard Blom OCCWeb diff --git a/js/index.js b/js/index.js index 214e84a..739aa6f 100644 --- a/js/index.js +++ b/js/index.js @@ -17,7 +17,8 @@ // occ output is plain text with ANSI colors, but jQuery Terminal reads // "[" and "]" as its own formatting syntax. Escape the brackets in the // text (e.g. Symfony's "[alias]" in `occ list`) and leave the ANSI - // sequences alone, so from_ansi can still turn them into colors. + // sequences alone, so from_ansi can still turn them into colors. This + // only works together with unixFormattingEscapeBrackets (see below). function escapeOutputBrackets(output) { return String(output).replace(/(\x1B\[[0-9;]*[A-Za-z])|[\[\]]/g, function (match, ansi) { return ansi ? ansi : (match === '[' ? '[' : ']'); @@ -408,6 +409,9 @@ name: 'occ', prompt: OCC_PROMPT, completion: response, + // The overtyping and from_ansi formatters unescape brackets before + // parsing; this makes them escape the text again afterwards. + unixFormattingEscapeBrackets: true, keydown: function (e) { // Shift+Enter inserts a newline instead of running the command, // letting you type multi-line SQL scripts in sql mode.