Skip to content

Commit

Permalink
fix: code assistant next change scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
carlrobertoh committed Jan 7, 2025
1 parent 81615f7 commit 5eef1ea
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 5eef1ea

Please sign in to comment.