mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
PY-75987 [Jupyter] Fix folding bar position calculation on notebook open
GitOrigin-RevId: f8db05c845ceef6d0d5179a59256743107e1c49e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6c9df4d083
commit
ce7635909f
@@ -70,7 +70,7 @@ class NotebookCellInlayManager private constructor(
|
||||
val newCtx = UpdateContext(force)
|
||||
updateCtx = newCtx
|
||||
try {
|
||||
JupyterBoundsChangeHandler.get(editor)?.postponeUpdates()
|
||||
JupyterBoundsChangeHandler.get(editor).postponeUpdates()
|
||||
val r = keepScrollingPositionWhile(editor) {
|
||||
val r = block(newCtx)
|
||||
updateCtx = null
|
||||
@@ -78,7 +78,7 @@ class NotebookCellInlayManager private constructor(
|
||||
r
|
||||
}
|
||||
inlaysChanged()
|
||||
JupyterBoundsChangeHandler.get(editor)?.performPostponed()
|
||||
JupyterBoundsChangeHandler.get(editor).performPostponed()
|
||||
r
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -120,6 +120,6 @@ class JupyterBoundsChangeHandler(val editor: EditorImpl) : Disposable {
|
||||
editor.putUserData(INSTANCE_KEY, updater)
|
||||
}
|
||||
|
||||
fun get(editor: Editor): JupyterBoundsChangeHandler? = INSTANCE_KEY.get(editor)
|
||||
fun get(editor: Editor): JupyterBoundsChangeHandler = INSTANCE_KEY.get(editor)
|
||||
}
|
||||
}
|
||||
@@ -125,9 +125,9 @@ class DecoratedEditor private constructor(
|
||||
|
||||
override fun validateTree() {
|
||||
keepScrollingPositionWhile(editor) {
|
||||
JupyterBoundsChangeHandler.get(editor)?.postponeUpdates()
|
||||
JupyterBoundsChangeHandler.get(editor).postponeUpdates()
|
||||
super.validateTree()
|
||||
JupyterBoundsChangeHandler.get(editor)?.performPostponed()
|
||||
JupyterBoundsChangeHandler.get(editor).performPostponed()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class EditorCellFoldingBar(
|
||||
val panel = createFoldingBar()
|
||||
editor.gutterComponentEx.add(panel)
|
||||
this.panel = panel
|
||||
JupyterBoundsChangeHandler.get(editor)?.subscribe(boundsChangeListener)
|
||||
JupyterBoundsChangeHandler.get(editor).subscribe(boundsChangeListener)
|
||||
updateBounds()
|
||||
}
|
||||
else {
|
||||
@@ -64,7 +64,7 @@ class EditorCellFoldingBar(
|
||||
remove(it)
|
||||
repaint()
|
||||
}
|
||||
JupyterBoundsChangeHandler.get(editor)?.unsubscribe(boundsChangeListener)
|
||||
JupyterBoundsChangeHandler.get(editor).unsubscribe(boundsChangeListener)
|
||||
panel = null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class EditorCellOutputs(
|
||||
field = value
|
||||
|
||||
if (shouldUpdate) {
|
||||
JupyterBoundsChangeHandler.get(editor)?.boundsChanged()
|
||||
JupyterBoundsChangeHandler.get(editor).boundsChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ internal class EditorEmbeddedComponentLayoutManager(private val editor: EditorEx
|
||||
// [com.intellij.openapi.editor.impl.FoldingModelImpl.onCustomFoldRegionPropertiesChange] fires listeners
|
||||
// before make model consistent.
|
||||
// Here we have to call it once again to get correct bounds.
|
||||
JupyterBoundsChangeHandler.get(customFoldRegion.editor)!!.boundsChanged()
|
||||
JupyterBoundsChangeHandler.get(customFoldRegion.editor).boundsChanged()
|
||||
}
|
||||
|
||||
override val order: Int
|
||||
|
||||
Reference in New Issue
Block a user