mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
PY-69893 Fix cell outputs update after clear
GitOrigin-RevId: 42905a11209130d9fde8c8f1af6459550e4ba417
This commit is contained in:
committed by
intellij-monorepo-bot
parent
601aa49801
commit
059d525249
@@ -69,8 +69,8 @@ class EditorCellOutput internal constructor(private val editor: EditorEx, privat
|
||||
|
||||
fun onViewportChange() {
|
||||
val component = component.mainComponent as? NotebookOutputInlayShowable ?: return
|
||||
if (component !is Component) return
|
||||
|
||||
if (component !is JComponent) return
|
||||
validateComponent(component)
|
||||
val componentRect = SwingUtilities.convertRectangle(component, component.bounds, editor.scrollPane.viewport.view)
|
||||
component.shown = editor.scrollPane.viewport.viewRect.intersects(componentRect)
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ class EditorCellOutputs(
|
||||
?: emptyList()
|
||||
updateData(outputDataKeys)
|
||||
recreateInlayIfNecessary()
|
||||
onViewportChange()
|
||||
}
|
||||
|
||||
private fun recreateInlayIfNecessary() {
|
||||
@@ -116,6 +117,7 @@ class EditorCellOutputs(
|
||||
}
|
||||
else {
|
||||
inlay?.let { Disposer.dispose(it) }
|
||||
inlay = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.openapi.editor.ex.EditorEx
|
||||
import com.intellij.openapi.editor.impl.EditorComponentImpl
|
||||
import com.intellij.openapi.editor.impl.EditorEmbeddedComponentManager
|
||||
import com.intellij.openapi.editor.impl.EditorEmbeddedComponentManager.Properties.RendererFactory
|
||||
import java.awt.Container
|
||||
import java.awt.event.ComponentAdapter
|
||||
import java.awt.event.ComponentEvent
|
||||
import java.awt.event.HierarchyEvent
|
||||
@@ -112,3 +113,11 @@ fun JComponent.yOffsetFromEditor(editor: Editor): Int? =
|
||||
SwingUtilities.convertPoint(this, 0, 0, editor.contentComponent).y
|
||||
.takeIf { it >= 0 }
|
||||
?.let { it + insets.top }
|
||||
|
||||
fun validateComponent(c: Container) {
|
||||
var validationRoot = c
|
||||
while (!validationRoot.isValidateRoot && validationRoot.parent != null) {
|
||||
validationRoot = validationRoot.parent
|
||||
}
|
||||
validationRoot.validate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user