mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-18 23:42:49 +00:00
fix: illegal component state exception
This commit is contained in:
parent
a596fa969c
commit
091fda4557
1 changed files with 7 additions and 0 deletions
|
|
@ -42,6 +42,7 @@ import java.awt.event.KeyEvent
|
|||
import javax.swing.Box
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JPanel
|
||||
import javax.swing.SwingUtilities
|
||||
|
||||
class CodeSuggestionDiffViewer(
|
||||
request: DiffRequest,
|
||||
|
|
@ -294,6 +295,12 @@ fun UnifiedDiffChange.getChangedLinesCount(): Int {
|
|||
|
||||
fun getAdjustedPopupLocation(popup: JBPopup, editor: Editor, changeOffset: Int): Point {
|
||||
val pointInEditor = editor.offsetToXY(changeOffset)
|
||||
if (!editor.component.isShowing) {
|
||||
val point = Point(pointInEditor)
|
||||
SwingUtilities.convertPointToScreen(point, editor.component)
|
||||
return point
|
||||
}
|
||||
|
||||
val visibleArea = editor.scrollingModel.visibleArea
|
||||
val editorLocationOnScreen = editor.component.locationOnScreen
|
||||
val isOffsetVisible = visibleArea.contains(pointInEditor)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue