Skip to content

Missing ANSI Italic Style and Rendering Error in Underline Style #4105

@raphaelNguyen

Description

@raphaelNguyen

Description

After upgrading to version >= 2.25.0, when rendering ansi, italic styling on log message no longer works (triggers a warning that the style italic is invalid) while underline styling on log message produces italic effect on rendered text. The warning message includes a stack trace that points to AnsiEscape.createSequence failing to create sequence for style name italic at the line below in JAnsiTextRenderer.

merge(AnsiEscape.createSequence(styleName), output, first);

This seems to boil down to #3070, which rewrites JAnsiTextRenderer to use AnsiEscape instead of depending on external Jansi library to generate ansi escape sequences. However, the enum AnsiEscape differs from the enums in the old external Jansi library in that:

  • AnsiEscape does not have the ITALIC entry.
  • AnsiEscape.UNDERLINE has the code value of 3 which correspond to ITALIC.
  • Code value 4 which corresponds to underline style seems to not be assigned to any enum value in AnsiEscape.

(Style code referenced from https://en.wikipedia.org/wiki/ANSI_escape_code#Select_Graphic_Rendition_parameters)

I'm wondering if this was a bug that existed in AnsiEscape from a long time ago that was just never noticed. The enum values from this file seems to have been unchanged for a long time. Thank you for your assistant with this issue.

Configuration

Version: >= 2.25.0

Operating system: Windows 11

JDK: 17.0.16

Logs

// to be supplied
[Stacktraces, errors, etc. relevant applications logs.]

Reproduction

Will supplement this at a later time.
[An isolated test reproducing the test.
JUnit tests similar to the ones in the code base are extremely appreciated.]

Metadata

Metadata

Labels

bugIncorrect, unexpected, or unintended behavior of existing codelayoutsAffects one or more Layout plugins

Type

No type
No fields configured for issues without a type.

Projects

Status
To triage

Relationships

None yet

Development

No branches or pull requests

Issue actions