ErrorStrip does not expose a way to change how markers are painted (for example, to draw them with a "flat" UI style). To change the painting style you must make a private copy of the class and then keep it in synch with upstream changes. This PR addresses this with the following changes:
caret painting delegates to a new protected method paintCaretMarker(g, w, h)
marker painting delegates to a new protected method paintParserMarkerNotice(g, notice, w, h)
a new property, caretMarkerOnTop, allows control over whether the caret marker is drawn under other markers (as it currently is) or over them
The painting delegates expose a small rectangle (the width of the component and the height of a parser notice marker) for the subclass to paint as desired. In the case of the caret delegate, the rectangle is centered around the y-position for the caret. The base class paints the markers in the same style as the original implementation.
A future change might allow the subclass to choose which notice(s) to paint, but that is not addressed here. It uses the existing method in Marker to choose a notice based on priority, slightly modified (and suitably renamed) to return the notice rather than its colour. (As an example of how multiple notices might be used, in VS Code there is a similar strip but different kinds of markers (errors, search matches, diffs) are drawn in different columns.)
ErrorStrip
does not expose a way to change how markers are painted (for example, to draw them with a "flat" UI style). To change the painting style you must make a private copy of the class and then keep it in synch with upstream changes. This PR addresses this with the following changes:paintCaretMarker(g, w, h)
paintParserMarkerNotice(g, notice, w, h)
caretMarkerOnTop
, allows control over whether the caret marker is drawn under other markers (as it currently is) or over themThe painting delegates expose a small rectangle (the width of the component and the height of a parser notice marker) for the subclass to paint as desired. In the case of the caret delegate, the rectangle is centered around the y-position for the caret. The base class paints the markers in the same style as the original implementation.
A future change might allow the subclass to choose which notice(s) to paint, but that is not addressed here. It uses the existing method in
Marker
to choose a notice based on priority, slightly modified (and suitably renamed) to return the notice rather than its colour. (As an example of how multiple notices might be used, in VS Code there is a similar strip but different kinds of markers (errors, search matches, diffs) are drawn in different columns.)