On Friday 19 May 2017 05:40 PM, Damien Pollet wrote:
I wouldn't want to sound sarcastic, but I'm not sure there is such a
concept as "correct" in the context of ANSI escape sequences.
Still, according to the legends, 97 is supposed to be high intensity
white (for some subset of existing implementations).
;-). My context was command line usage in linux terminals.
Anyway, attached is a patch for the annoying bug which fixed the problem
for me. I would appreciate if anyone else using the command line can
confirm if the patch works for them. E.g.
~~~~
$ ./pharo Pharo.image eval 'ProtoObject methodDict size\;^MProtoObject
methodDict keys'
Syntax Error on line 1: 'Variable or expression expected'
=========================================================
1: ProtoObject methodDict size\;
_^_
2: ProtoObject methodDict keys
$ ./pharo Pharo.image eval 'ProtoObject methodDict size.^MProtoObject
methodDict keys;'
Syntax Error on line 2: 'Message expected'
==========================================
1: ProtoObject methodDict size.
2: ProtoObject methodDict keys;
_^_
$
~~~~
Thanks .. Subbu
'From Pharo6.0 of 13 May 2016 [Latest update: #60473] on 19 May 2017 at 8:03:31.630191 pm'!
"Change Set: resetcolor
Date: 19 May 2017
Author: kks
reset colors after printing error messages while parsing"!
!STCommandLineHandler class methodsFor: 'printing' stamp: 'kks 5/19/2017 20:01'!
printCompilerWarning: aSyntaxErrorNotification
| stderr position contents errorLine errorMessage maxLineNumberSize lineNumber |
"format the error"
position := aSyntaxErrorNotification location.
contents := aSyntaxErrorNotification errorCode.
errorLine := contents lineNumberCorrespondingToIndex: position.
stderr := VTermOutputDriver stderr.
"first gather the error title to be able to underline it properly"
errorMessage := String streamContents: [ :s|
s nextPutAll: 'Syntax Error on line ';
print: errorLine; nextPutAll: ': ';
print: aSyntaxErrorNotification errorMessage].
stderr red;
nextPutAll: errorMessage; lf;
nextPutAll: ('' padLeftTo: errorMessage size with: $=); lf;
clear.
"print each source line and mark the found syntax error"
maxLineNumberSize := contents lines size asString size.
lineNumber := 0.
contents lineIndicesDo: [:start :endWithoutDelimiters :end |
lineNumber := lineNumber + 1.
lineNumber == errorLine ifTrue: [ stderr errorColor ].
"0 pad the line numbers to the same size"
stderr
nextPutAll: (lineNumber asString padLeftTo: maxLineNumberSize with: $0);
nextPutAll: ': ';
nextPutAll: (contents copyFrom: start to: endWithoutDelimiters);
lf.
"print the marker under the error line"
(lineNumber == errorLine)
ifTrue: [
stderr nextPutAll:( '_^_' padLeftTo: position - start + maxLineNumberSize + 4);
lf;
clear]
]! !
!VTermOutputDriver methodsFor: 'coloring' stamp: 'kks 5/19/2017 19:58'!
errorColor
self red! !