Fix italic and underline ANSI escape codes - #4184
Conversation
AnsiEscape had UNDERLINE mapped to SGR 3 (italic) and no ITALIC entry. Map italic to 3 and underline to 4, and cover both with regression tests.
|
@kamilkrzywanski, thanks! I'll try to get this cleared whenever I find the time. Thanks for your patience. |
| * compare equal to itself. | ||
| * </p> | ||
| */ | ||
| class AnsiEscapeTest { |
There was a problem hiding this comment.
Can u extend the test case for remaining format also?
| "", | ||
| "@|white key|@ = @|cyan,bold some value|@", | ||
| "\u001b[37mkey\u001b[m = \u001b[36;1msome value\u001b[m"), | ||
| // GitHub issue #4105: italic = SGR 3, underline = SGR 4 |
There was a problem hiding this comment.
not needed remove the comments
| "", | ||
| "@|italic italic text|@ and @|underline underlined text|@", | ||
| "\u001b[3mitalic text\u001b[m and \u001b[4munderlined text\u001b[m"), | ||
| // Return broken escapes as is |
There was a problem hiding this comment.
here also remove comments
There was a problem hiding this comment.
On the issue, @vy suspected AnsiEscape should also be "checked for other differences" against Jansi — that part is still open. Worth doing the full sweep: walk every constant in org.fusesource.jansi.AnsiRenderer.Code (the enum JAnsiTextRenderer.toCode used before #3070) and check it resolves in AnsiEscape. italic isn't the only casualty — try faint or blink_slow and you'll see the pattern. A quick way to check a candidate: AnsiEscape.createSequence(name) returning a bare ESC[m means the name didn't resolve, so the style silently does nothing and you get a The style attribute X is incorrect. warning on the StatusLogger.
Add missing AnsiRenderer.Code names (faint, blink_slow, etc.), extend SGR mapping tests, and drop the extra test comments from review.
|
@ramanathan1504 thanks for the review. Did the full Jansi Should be ready for another look. |
Fixes #4105.
AnsiEscapewas missingitalic(SGR 3) and hadunderlinemapped to 3 instead of 4. After the Jansi removal, that madeitalicwarn as invalid andunderlinerender as italic.Changes
ITALIC("3")and correctUNDERLINEto"4"italicin the pattern layout style keywordsChecklist
2.xbranch if you are targeting Log4j 2; usemainotherwise./mvnw verifypassedsrc/changelog/.2.x.xdirectory