Skip to content

ErrorList applies black colour on ESC sequence reset #333

@mpheath

Description

@mpheath

ESC[0m and ESC[m apply SCE_ERR_ES_BLACK when it should reset to default. View text-formatting which states:

Value Description Behavior
0 Default Returns all attributes to the default state prior to modification

0 is not a colour. It is a reset to default state. StyleFromSequence() treats everything as a colour so it treats 0 as SCE_ERR_ES_BLACK .

The issue is that SCE_ERR_ES_BLACK is not visible if the background colour is black. So example:

ESC[31m Red colour ESC[m Cannot see this black coloured text if the background is black

This image posted shows the issue as CRLF are visible except for those after ESC[0m which are black on a black background.

Image

Patch code:

diff --git a/lexers/LexErrorList.cxx b/lexers/LexErrorList.cxx
index 22f831ec..f8fbd447 100644
--- a/lexers/LexErrorList.cxx
+++ b/lexers/LexErrorList.cxx
@@ -371,7 +371,9 @@ void ColouriseErrorListLine(
 				return;
 			case 'm':	// Colour command
 				styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ);
-				portionStyle = StyleFromSequence(startSeq+2);
+				// ESC[m or ESC[0m reset to default style else get the colour style.
+				portionStyle = (startSeq[2] == 'm' || (startSeq[2] == '0' && startSeq[3] == 'm')) ?
+				               SCE_ERR_DEFAULT : StyleFromSequence(startSeq+2);
 				break;
 			case 'K':	// Erase to end of line -> ignore
 				styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ);

Updated LexErrorList.cxx and test files:

fix.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    committedIssue fixed in repository but not in releaseerrorlistCaused by the errorlist lexer

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions