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) }