Skip to content
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

Wrong bracket when echo formatting in brackets #396

Closed
jcubic opened this issue May 18, 2018 · 3 comments
Closed

Wrong bracket when echo formatting in brackets #396

jcubic opened this issue May 18, 2018 · 3 comments

Comments

@jcubic
Copy link
Owner

jcubic commented May 18, 2018

Expected behavior

formatting in brackets:

term.echo('[[[b;#fff;]hello]]')

should display [hello] with text as white.

Actual behavior

it shows: [hello][ (in prompt it's fine, so it's only for echo).

@vitalyo7
Copy link

vitalyo7 commented May 18, 2018

Having similar issue with unix formatting + color formatting, i am trying to render some c/assembly text that uses color code and [] brackets.

term.echo("�[0m[�[36m�[33m0x109de1d4�[0m]�[36m�[0m�[0m�[31m")

Unix formatting produce the following string which does not seem to render correctly.
[[[;#0AA;]][[;#A50;]0x109de1d4]][[;#0AA;]][[;#A00;]]

PS: It looks like the following characters [ and ] when mixed with color coding tags, cause some odd behavior. I looked a jquery.terminal and it looks like it may be the way you are splitting the tokens.

My guess is that it has something to do with using parser vs regex that may be causing this behavior.

@jcubic
Copy link
Owner Author

jcubic commented May 19, 2018

With unix formatting you can use this long option unixFormattingEscapeBrackets added by @ml1nk in #372 it seems that I've forget to add it to documentation. It fix the problem, the same when I use:

term.echo('[[[b;#fff;]hello]]')

jcubic added a commit that referenced this issue May 21, 2018
@jcubic
Copy link
Owner Author

jcubic commented May 21, 2018

There was two problems one in nested formatting function and the second was in extended commands, your example was invoking commands. And the problem was regex \[\[(?:[^\]])* which was matching [[[ where is should skip first brackets, adding regex [^\][] solved the issue.

@jcubic jcubic closed this as completed Jun 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants