question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG - Develop] `EvForm` generates extraneous ANSI codes

See original GitHub issue

Describe the bug

Putting styling in an EvForm template seems to result in the style being extraneously re-applied further down the form. The issue is masked by the way ANSI code is parsed by consoles - I only discovered it through the webclient.

To Reproduce

I don’t fully understand what’s happening well enough to create a reproducible test case, but here’s the situation where I identified the problem.

My form text:

.----------------------------------------------------------------------------.
| |wNAME|n: xxxxxxxxxx1xxxxxxxxxxxx xxxx2xxxxx    F A T E   xxxxxxxxxxxxxxxxxxxx |
|                                              /x4x|n\\    xxxxxxxxxxxxxxxxxxxx |
| |wDESC|n: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx      [-----]   xxxxxxxxx0xxxxxxxxxx |
|       xxxxxxxxxxxx3xxxxxxxxxxxxxxxxxxx       \\x5x/    xxxxxxxxxxxxxxxxxxxx |
|       xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx      REFRESH   xxxxxxxxxxxxxxxxxxxx |
 >--------------------------------------------------------------------------<
| |*> ASPECTS > > > > > > > > > |n | |*> SKILLS > > > > > > > > > > > > > > > > > |n |
| cccccccccccccccccccccccccccc | ccccccccccccccccccccccccccccccccccccccccccc |
| cccccccccccccccccccccccccccc | ccccccccccccccccccccccccccccccccccccccccccc |
| ccccccccccccAccccccccccccccc | ccccccccccccccccccccccBcccccccccccccccccccc |
| cccccccccccccccccccccccccccc | ccccccccccccccccccccccccccccccccccccccccccc |
| cccccccccccccccccccccccccccc | ccccccccccccccccccccccccccccccccccccccccccc |
| cccccccccccccccccccccccccccc | ccccccccccccccccccccccccccccccccccccccccccc |
 >--------------------------------------------------------------------------<
| |*(Phys) > > STRESS < < (Ment)|n | |*> STUNTS and EXTRAS  > > > > > > > > > > > |n |
| xxxxxx6xxxxxx  xxxxxx7xxxxxx | ccccccccccccccccccccccccccccccccccccccccccc |
|                              | ccccccccccccccccccccccccccccccccccccccccccc |
| |*> CONSEQUENCE > > > > > > > |n | ccccccccccccccccccccccccccccccccccccccccccc |
| cccccccccccccccccccccccccccc | ccccccccccccccccccccccccccccccccccccccccccc |
| cccccccccccccccccccccccccccc | ccccccccccccccccccccccDcccccccccccccccccccc |
| ccccccccccccCccccccccccccccc | ccccccccccccccccccccccccccccccccccccccccccc |
| cccccccccccccccccccccccccccc | ccccccccccccccccccccccccccccccccccccccccccc |
 ----------------------------------------------------------------------------

The output to my log via logger.log_msg:

.----------------------------------------------------------------------------.
| ^[1m^[37mNAME^[0m: ^[0mGM(#1)                 ^[0m^[1m^[37m^[0m ^[0mthey/them ^[0m^[1m^[37m^[0m^[0m^[0m^[1m^[37m^[0m    F A T E   ^[0m^[1m^[37m       .           ^[0m ^[0m^[1m^[37m^[0m^[0m^[0m^[1m^[37m^[0m^[0m^[0m^[1m^[37m^[0m^[0m^[0m^[1m^[37m^[0m |
|                                              /^[0m.0.^[0m^[0m\    ^[0m^[1m^[37m^[0m^[1m^[37m.!=== / \ =========^[0m ^[0m^[0m^[0m^[0m |
| ^[1m^[37mDESC^[0m: ^[0mThis is User #1.                ^[0m^[1m^[37m^[0m      [-----]   ^[0m^[1m^[37m^[0m^[1m^[37m^[0m^[1m^[37m=!== /___\  !  !== ^[0m ^[0m^[1m^[37m^[0m |
|       ^[0m                                ^[0m       \^[0m.3.^[0m^[0m^[0m/    ^[0m^[1m^[37m^[0m^[1m^[37m^[0m^[1m^[37m^[0m^[1m^[37m.!  /     \ !  !===^[0m ^[0m |
|       ^[0m                                ^[0m      REFRESH   ^[0m^[1m^[37m^[0m^[1m^[37m^[0m^[1m^[37m^[0m^[1m^[37m^[0m      CORE MU*      ^[0m |
 >--------------------------------------------------------------------------< 
| ^[7m> ASPECTS > > > > > > > > > ^[0m | ^[7m> SKILLS > > > > > > > > > > > > > > > > > ^[0m |
| ^[0m^[0mconcept ^[0m     ^[0m^[0m^[0mI'm A Genius ^[0m  ^[0m | ^[0m^[0mGreat (+4) ^[0m .......^[0m^[0m^[0mDecei, Lore, Resou ^[0m ....^[0m^[0m^[0m^[0m^[0m^[0m^[0m^[0m^[0m |
| ^[0m^[0mtrouble ^[0m     ^[0m^[0m^[0mOh No! ^[0m        ^[0m | ^[0m^[0mGood (+3) ^[0m ........^[0m^[0m^[0mCraft, Inves, Rappo ^[0m ...^[0m^[0m^[0m^[0m^[0m^[0m^[0m^[0m^[0m |
| ^[0m             ^[0m^[0m               ^[0m | ^[0m^[0mFair (+2) ^[0m ........^[0m^[0m^[0mConta, ^[0mFight, ^[0mPr[...]...^[0m^[0m^[0m^[0m^[0m |
| ^[0m             ^[0m^[0m               ^[0m | ^[0m^[0mAverage (+1) ^[0m .....^[0m^[0m^[0mBurgl, ^[0mEmpat, ^[0mPh[...]...^[0m^[0m^[0m^[0m^[0m |
| ^[0m             ^[0m^[0m               ^[0m | ^[0m^[0mMediocre (+0) ^[0m ....^[0m^[0m^[0mAthle, ^[0mDrive, ^[0mNotic, ^[0m...^[0m^[0m^[0m^[0m^[0m |
| ^[0m             ^[0m^[0m               ^[0m | ^[0m...................^[0m^[0m^[0mShoot^[0m...................^[0m^[0m^[0m^[0m^[0m |
 >--------------------------------------------------------------------------< 
| ^[7m(Phys) > > STRESS < < (Ment)^[0m | ^[7m> STUNTS and EXTRAS  > > > > > > > > > > > ^[0m |
| ^[0m^[1m^[37m[1]^[0m^[1m^[37m[2]^[0m[3][4] ^[0m  ^[0m.^[1m^[37m[1]^[0m^[1m^[37m[2]^[0m[3][4]^[0m^[0m^[1m^[37m^[0m^[1m^[37m^[0m^[0m | ^[0m^[0mstunts ^[0m                                    ^[0m^[0m^[1m^[37m^[0m^[1m^[37m^[0m^[0m^[0m^[1m^[37m^[0m^[1m^[37m^[0m^[0m^[0m^[1m^[37m^[0m^[1m^[37m^[0m^[0m |
|                              | ^[0m^[0mextras ^[0m                                    ^[0m |
| ^[7m> CONSEQUENCE > > > > > > > ^[0m | ^[0m                                           ^[0m^[7m^[0m |
| ^[0m^[0m^[1m^[37m[2]^[0m ^[0m                        ^[0m | ^[0m                                           ^[0m |
| ^[0m^[0m^[1m^[37m[4]^[0m ^[0m                        ^[0m | ^[0m                                           ^[0m |
| ^[0m^[0m^[1m^[37m[6]^[0m ^[0m                        ^[0m | ^[0m                                           ^[0m |
| ^[0m^[0m[2] ^[0m                        ^[0m | ^[0m                                           ^[0m |
 ---------------------------------------------------------------------------- 
                                                                              

To highlight a specific line:

Input string:
| |*> CONSEQUENCE > > > > > > > |n | ccccccccccccccccccccccccccccccccccccccccccc |

Output string: 
| ^[7m> CONSEQUENCE > > > > > > > ^[0m | ^[0m                                           ^[0m^[7m^[0m |

There are a ton of extra ANSI normal flags all throughout the text, but those aren’t in themselves much of an issue - it’s the reoccurrence of previous flags that’s concerning.

Develop-branch commit

6edf9064c

Additional context

After seeing what’s going on, I can (and will) patch text2html to correct for it by having the ANSI normal flag override any previous adjacent flags, which should fix the user-facing issues. However, there’s clearly something amiss in the way the form template is being converted that should likely be addressed at some point.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Griatchcommented, Nov 5, 2022

No worries. Just fyi, I have refactored EvForm quite a bit (hopefully push today, but I need to look at another EvForm-related issue you posted first 😉 )

0reactions
Griatchcommented, Nov 5, 2022

So one thing that happens with this is that EvCell generates ANSI_NORMAL markers on either side of each line of a rectangle. In contrast, EvForm will escape any |-type markup, so what comes out of EvForm will be a mixture of |n and ^[0m^[1m^ (the actual parsing of the former happen when you send the data to the protocol). This is of course not ideal.

But the future plan is to modify how we deal with markup (this goes beyond webclient, it’s a change for all prototocols) so I prefer to not mess more with it. In the future, the correct way would be to only see |- style markers coming out of EvForm, and they not being parsed to something until it hits the protocol.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · evennia/evennia
[BUG - Develop] EvForm generates extraneous ANSI codes branch-develop Will be solved on `develop` branch. bug An actual error or unwanted behavior.
Read more >
npm windows install globally results in npm ERR! extraneous
npm ERR! extraneous means a package is installed but is not listed in your project's package.json . Since you're listing packages that have...
Read more >
Viewing online file analysis results for 'wc.NAVI.EXE'
This report is generated from a file or URL submitted to this webservice on December 4th 2017 23:06:51 (UTC) Guest System: Windows 7...
Read more >
TechDocs Archives
Abstract—Imperfect electrical connections cause multiple problems in radio frequency (RF) measurements, passive intermodulation (PIM) being the most common one.
Read more >
high-resolution raster graphics
Often this is done by generating several coarser resolution rasters from a fine ... A two-dimensional disruption thermal analysis code (DREAM) was developed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found