From 5eef1eabef9a87f7e5f676cd9af51883d8b31cfb Mon Sep 17 00:00:00 2001 From: Carl-Robert Linnupuu Date: Mon, 6 Jan 2025 13:55:37 +0000 Subject: [PATCH] fix: code assistant next change scrolling --- .../carlrobert/codegpt/predictions/CodeSuggestionDiffViewer.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ee/carlrobert/codegpt/predictions/CodeSuggestionDiffViewer.kt b/src/main/kotlin/ee/carlrobert/codegpt/predictions/CodeSuggestionDiffViewer.kt index 659fd901..87fb0b7b 100644 --- a/src/main/kotlin/ee/carlrobert/codegpt/predictions/CodeSuggestionDiffViewer.kt +++ b/src/main/kotlin/ee/carlrobert/codegpt/predictions/CodeSuggestionDiffViewer.kt @@ -15,6 +15,7 @@ import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.ActionManager import com.intellij.openapi.editor.Document import com.intellij.openapi.editor.Editor +import com.intellij.openapi.editor.LogicalPosition import com.intellij.openapi.editor.event.DocumentEvent import com.intellij.openapi.editor.event.DocumentListener import com.intellij.openapi.editor.event.VisibleAreaEvent @@ -214,7 +215,7 @@ class CodeSuggestionDiffViewer( } private fun scrollToChange(change: UnifiedDiffChange) { - val pointToScroll = myEditor.offsetToXY(change.lineFragment.startOffset2) + val pointToScroll = myEditor.logicalPositionToXY(LogicalPosition(change.line1, 0)) pointToScroll.y -= myEditor.lineHeight DiffUtil.scrollToPoint(myEditor, pointToScroll, false) }