-
-
Notifications
You must be signed in to change notification settings - Fork 576
Terminal execute command from escaped brackets #993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Another issue is calling: term.echo($.terminal.escape_brackets($.terminal.apply_formatters(output)));
// Recursive loop in echo detected, skip |
Hi @jcubic! I ran into a similar issue with JSON output: const term = $('body').terminal({});
const output = `[[[]]]`;
term.echo(output); resulting into this error:
Setting the const term = $('body').terminal({});
const output = `[[[]]]`;
term.echo(output, { raw: true }); Output: [[[]]] The indentation is lost though with Shouldn't it be the default that the |
This is not the same issue. Syntax like const term = $('body').terminal({});
const output = String.raw`\[\[\[\]\]\]`
term.echo(output); The problem the issue describe is with escaping. It seems that the |
It seems that escape_brackets doesn't work at all: const output = $.terminal.escape_brackets(`[[;white;]x]`);
term.echo(output);
// white x It may be a regression that was not tested. |
Thanks for the quick response! 👍
With output buffering, it may make sense to provide a flag to disable the extended command treatment. For example: // just buffer and do not treat it as an extended command
$('body').terminal().echo(`[[ ... ]]`, { flush: false });
const output = $('body').terminal().get_output_buffer();
$('body').terminal().clear_buffer();
$('body').terminal().echo($.terminal.escape_brackets(output)); UPDATE: Adding $('body').terminal().echo(`[[ ... ]]`, { flush: false, exec: false }); For color codes too, it seems to be working fine on my side:
|
Yes, it seems that the issue is only when xml formatter is included on the page. As in the description of the issue. |
Issue summary
If you write XML inside escaped brackets, the terminal will invoke the HTML as extended command
Expected behavior
It should print the brackets and apply formatting inside
Steps to reproduce
Browser and OS
N/A
Additional notes
The library probably unescapes the brackets on some point
The text was updated successfully, but these errors were encountered: