Skip to content

Commit c4ae849

Browse files
committed
Fix clicking on ErrorStrip brings cursor to the top no matter where you click
1 parent b0af907 commit c4ae849

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MyErrorStripe.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private int yToLine(int y)
8686
if (y < h)
8787
{
8888
float at = y / (float) h;
89-
line = Math.round((Math.max(lineCount, linesPerVisibleRect) - 1) * at);
89+
line = Math.round((float) (Math.max(lineCount, linesPerVisibleRect) - 1) * at);
9090
}
9191

9292
return line;
@@ -199,7 +199,6 @@ public void removeNotify()
199199

200200
private class Listener extends MouseAdapter
201201
{
202-
private final Rectangle r = new Rectangle();
203202

204203
@Override
205204
public void mouseClicked(@NotNull MouseEvent e)
@@ -219,7 +218,7 @@ public void mouseClicked(@NotNull MouseEvent e)
219218
{
220219
try
221220
{
222-
int offset = textArea.getLineOfOffset(line);
221+
int offset = textArea.getLineStartOffset(line);
223222
textArea.setCaretPosition(offset);
224223
RSyntaxUtilities.selectAndPossiblyCenter(textArea, new DocumentRange(offset, offset), false);
225224
}

0 commit comments

Comments
 (0)