From 8655164a8ea17e401daf6c8972f952bce0ddae33 Mon Sep 17 00:00:00 2001 From: Rosemoe <2073412493@qq.com> Date: Sat, 17 Feb 2024 14:28:27 +0800 Subject: [PATCH] fix(editor): wrong adjusted scroll position after scaling in wordwrap --- .../src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java b/editor/src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java index 969361b8a..fea4eda92 100644 --- a/editor/src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java +++ b/editor/src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java @@ -3040,7 +3040,7 @@ public void setLayoutBusy(boolean busy) { int column = IntPair.getSecond(touchHandler.memoryPosition); // Compute new scroll position var row = ((WordwrapLayout) layout).findRow(line, column); - var afterScrollY = row * getRowHeight() - getHeight() + touchHandler.focusY; + var afterScrollY = row * getRowHeight() - touchHandler.focusY; var scroller = touchHandler.getScroller(); dispatchEvent(new ScrollEvent(this, scroller.getCurrX(), scroller.getCurrY(), 0, (int) afterScrollY, ScrollEvent.CAUSE_SCALE_TEXT));