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

ANSI art from PabloDraw not compatible with Enigma #494

Closed
cognitivegears opened this issue Sep 3, 2023 · 3 comments
Closed

ANSI art from PabloDraw not compatible with Enigma #494

cognitivegears opened this issue Sep 3, 2023 · 3 comments

Comments

@cognitivegears
Copy link
Collaborator

Describe the Bug
ANSI art drawn with PabloDraw (at least version 3.3.12.0) is not compatible with Enigma. The reason is an unknown control sequence added by Pablo, "ESC [ #;#;#;#t (where # is various numbers). Since the regex doesn't catch this sequence, it treats it as literals and outputs it, but counts it as columns, throwing off all further processing for MCI codes etc.

To Reproduce
Save an art file with PabloDraw that includes at least one MCI code (I used MATRIX.ANS as an example.)

Expected Behavior
Page displays correctly with MCI codes in position.

Actual Behavior

MCI codes are off from the expected location.

Screenshots
Added in Discord, will add here if needed.

Environment

  • [X ] I am using Node.js v14.x LTS or higher
  • [X ] npm install or yarn reports success
  • Actual Node.js version (node --version): n/a
  • Operating system (uname -a on *nix systems): n/a
  • Revision (git rev-parse --short HEAD): n/a
  • Any additional relevant information about your setup
@cognitivegears
Copy link
Collaborator Author

Here is the code from the PabloDraw source base:

void GetRgbColourChanges (StringBuilder sb, bool force, Attribute attr, Attribute standardAttr)
			{
				if (force || lastRgbAttr.Background != attr.Background) {
					var col = palette [attr.Background];
					var standardCol = standardPalette [standardAttr.Background];
					if (col != standardCol || lastRgbAttr.Background != -1)
					{
						sb.AppendFormat("\x1b[0;{0};{1};{2}t", (byte)(col.R * 255), (byte)(col.G * 255), (byte)(col.B * 255));
						lastRgbAttr.Background = attr.Background;
					}
				}
				if (force || lastRgbAttr.Foreground != attr.Foreground) {
					var col = palette [attr.Foreground];
					var standardCol = standardPalette [standardAttr.Foreground];
					if (col != standardCol || lastRgbAttr.Foreground != -1)
					{
						sb.AppendFormat("\x1b[1;{0};{1};{2}t", (byte)(col.R * 255), (byte)(col.G * 255), (byte)(col.B * 255));
						lastRgbAttr.Foreground = attr.Foreground;
					}
				}
			}

(https://github.com/cwensley/pablodraw/blob/c1df6febcc7fb6b2d9b7876fb783ff224e0e87f5/Source/Pablo/Formats/Character/Types/Ansi.cs)

@cognitivegears
Copy link
Collaborator Author

This should be fixed with PR #495

@NuSkooler
Copy link
Owner

Nice work!

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