diff --git a/notebooks/visualization/src/com/intellij/notebooks/visualization/NotebookCellInlayManager.kt b/notebooks/visualization/src/com/intellij/notebooks/visualization/NotebookCellInlayManager.kt index 8227e9f40d0e..3ec4bad1fb57 100644 --- a/notebooks/visualization/src/com/intellij/notebooks/visualization/NotebookCellInlayManager.kt +++ b/notebooks/visualization/src/com/intellij/notebooks/visualization/NotebookCellInlayManager.kt @@ -136,11 +136,7 @@ class NotebookCellInlayManager private constructor( setupFoldingListener() setupSelectionUI() - notebook.addCellEventsListener(this, object : EditorCellEventListener { - override fun onEditorCellEvents(events: List) { - updateUI(events) - } - }) + notebook.addCellEventsListener(this) { events -> updateUI(events) } handleRefreshedDocument() } @@ -176,7 +172,7 @@ class NotebookCellInlayManager private constructor( return when { line < cell.interval.lines.first -> 1 line >= cell.interval.lines.last + 1 -> -1 - else -> return 0 + else -> 0 } } @@ -385,7 +381,7 @@ class NotebookCellInlayManager private constructor( change.subsequentPointers.forEach { addCell(it.pointer) } - //After insert we need fix ranges of previous cell + //After insert, we need fix ranges of previous cell change.subsequentPointers.forEach { val prevCell = getCellOrNull(it.interval.ordinal - 1) prevCell?.checkAndRebuildInlays() diff --git a/notebooks/visualization/src/com/intellij/notebooks/visualization/ui/providers/selection/NotebookEditorCellSelectionDetector.kt b/notebooks/visualization/src/com/intellij/notebooks/visualization/ui/providers/selection/NotebookEditorCellSelectionDetector.kt index 9fb3d2b1f8a2..ea935fde46b6 100644 --- a/notebooks/visualization/src/com/intellij/notebooks/visualization/ui/providers/selection/NotebookEditorCellSelectionDetector.kt +++ b/notebooks/visualization/src/com/intellij/notebooks/visualization/ui/providers/selection/NotebookEditorCellSelectionDetector.kt @@ -24,15 +24,13 @@ class NotebookEditorCellSelectionDetector(private val manager: NotebookCellInlay } init { - manager.addCellEventsListener(object : EditorCellEventListener { - override fun onEditorCellEvents(events: List) { + manager.addCellEventsListener( + { events -> val removedCells = events.filterIsInstance() for (event in removedCells) { selectionModel.removeCell(event.cell) } - } - }, this) - + }, this) editorImpl.caretModel.addCaretListener(object : CaretListener { override fun caretAdded(event: CaretEvent) = scheduleSelectionUpdate()