mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[intention-preview] Fix intention preview width
#IJPL-158759 Fixed GitOrigin-RevId: f988a806c89e029cdb3752bfd6c0559deb530d06
This commit is contained in:
committed by
intellij-monorepo-bot
parent
432e4e1019
commit
7ce6383034
+8
-4
@@ -174,7 +174,6 @@ class IntentionPreviewPopupUpdateProcessor internal constructor(
|
||||
IntentionPreviewComponent.NO_PREVIEW_LABEL
|
||||
}
|
||||
else {
|
||||
val size = component.preferredSize
|
||||
val location = popup.locationOnScreen
|
||||
val screen = ScreenUtil.getScreenRectangle(location)
|
||||
|
||||
@@ -185,13 +184,15 @@ class IntentionPreviewPopupUpdateProcessor internal constructor(
|
||||
if (origLocation != null && location.x < origLocation.x) {
|
||||
delta = delta.coerceAtMost(origLocation.x - screen.x - PositionAdjuster.DEFAULT_GAP)
|
||||
}
|
||||
size.width = size.width.coerceAtMost(delta)
|
||||
|
||||
for (editor in editors) {
|
||||
editor.softWrapModel.addSoftWrapChangeListener(object : SoftWrapChangeListener {
|
||||
override fun recalculationEnds() {
|
||||
val height = (editor as EditorImpl).offsetToXY(editor.document.textLength).y + editor.lineHeight + 6
|
||||
editor.component.preferredSize = Dimension(editor.component.preferredSize.width, min(height, MAX_HEIGHT))
|
||||
editor.component.preferredSize = Dimension(
|
||||
max(editor.component.preferredSize.width, MIN_WIDTH).coerceAtMost(delta),
|
||||
min(height, MAX_HEIGHT)
|
||||
)
|
||||
editor.component.parent?.invalidate()
|
||||
popup.pack(true, true)
|
||||
}
|
||||
@@ -199,7 +200,10 @@ class IntentionPreviewPopupUpdateProcessor internal constructor(
|
||||
override fun softWrapsChanged() {}
|
||||
})
|
||||
|
||||
editor.component.preferredSize = Dimension(max(size.width, MIN_WIDTH), min(editor.component.preferredSize.height, MAX_HEIGHT))
|
||||
editor.component.preferredSize = Dimension(
|
||||
max(editor.component.preferredSize.width, MIN_WIDTH).coerceAtMost(delta),
|
||||
min(editor.component.preferredSize.height, MAX_HEIGHT)
|
||||
)
|
||||
}
|
||||
|
||||
editorsToRelease.addAll(editors)
|
||||
|
||||
Reference in New Issue
Block a user