Skip to content

Commit bc169f8

Browse files
committed
Merge pull request #3903 from JakubValtar/error-marker-column
Error markers stay next to lines in short sketches
2 parents 8087550 + bf9d6d8 commit bc169f8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

java/src/processing/mode/java/MarkerColumn.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import processing.app.Sketch;
4040
import processing.app.SketchCode;
4141
import processing.app.Util;
42+
import processing.core.PApplet;
4243
import processing.mode.java.pdex.LineMarker;
4344
import processing.mode.java.pdex.Problem;
4445
import processing.app.Language;
@@ -207,12 +208,15 @@ private void recalculateMarkerPositions() {
207208
e.printStackTrace();
208209
totalLines = 1; // do not divide by zero
209210
}
211+
int visibleLines = editor.getTextArea().getVisibleLines();
212+
totalLines = PApplet.max(totalLines, visibleLines);
210213

211214
for (LineMarker m : errorPoints) {
212215
// Ratio of error line to total lines
213216
float y = (m.getLineNumber() + 1) / ((float) totalLines);
214217
// Ratio multiplied by height of the error bar
215-
y *= getHeight() - 15; // -15 is just a vertical offset
218+
y *= getHeight();
219+
y -= 15; // -15 is just a vertical offset
216220

217221
m.setY((int) y);
218222
}

0 commit comments

Comments
 (0)