[PyCharm] Jupyter (refactor): Improved cell--actions-toolbar positioning in case of different code analysis toolbars. #PY-87213 Ready For Merge

GitOrigin-RevId: 839e056a2e72004c80e7a101ca3747f7b96f33ac
This commit is contained in:
Nikita Pavlenko
2026-02-12 15:49:01 +01:00
committed by intellij-monorepo-bot
parent 7d2b340e0e
commit 0ce301dd5e

View File

@@ -69,11 +69,11 @@ internal class EditorCellActionsToolbarController(
}
}.cancelOnDispose(this)
editor.scrollingModel.addVisibleAreaListener({
if (!NotebookSettings.getInstance().cellToolbarStickyVisible) return@addVisibleAreaListener
val targetComponent = toolbar?.targetComponent ?: return@addVisibleAreaListener
updateToolbarPosition(targetComponent)
}, this)
editor.scrollingModel.addVisibleAreaListener {
if (!NotebookSettings.getInstance().cellToolbarStickyVisible) return@addVisibleAreaListener
val targetComponent = toolbar?.targetComponent ?: return@addVisibleAreaListener
updateToolbarPosition(targetComponent)
}
cell.isSelected.afterDistinctChange(this) {
updateToolbarVisibility()
@@ -210,8 +210,11 @@ internal class EditorCellActionsToolbarController(
// We have also EditorInspectionsActionToolbar in the top right editor corner, and we want to protect from overlap.
val statusComponent = (editor.scrollPane as? JBScrollPane)?.statusComponent
if (statusComponent != null) {
if (result.intersectsEvenIfEmpty(statusComponent.bounds.apply { y += editor.contentComponent.visibleRect.y })) {
result.y += statusComponent.height
val statusComponentLocation = SwingUtilities.convertPoint(statusComponent, Point(0, 0), editor.contentComponent)
val statusComponentBounds = Rectangle(statusComponentLocation, statusComponent.size)
if (result.intersectsEvenIfEmpty(statusComponentBounds)) {
result.y = statusComponentBounds.y + statusComponentBounds.height
}
}