[collab/space] IDEA-354681 Collapsed code fragment causes overlapping icons in gutter

Merge-request: IJ-MR-143760
Merged-by: Dmitrii Petukhov <dmitrii.petukhov@jetbrains.com>

GitOrigin-RevId: cf1dd675197df4818ac88ce9cd4507de3811e58f
This commit is contained in:
Dmitrii Petukhov
2024-08-31 16:42:21 +00:00
committed by intellij-monorepo-bot
parent f34c771a34
commit a7bce3459a

View File

@@ -112,6 +112,16 @@ private constructor(private val model: CodeReviewEditorGutterControlsModel,
// do not paint if there's not enough space
if (yShift > 0 && lineData.yRangeWithInlays.last - lineData.yRangeWithInlays.first < yShift + editor.lineHeight) return
val hasCommentsInFoldedRegion = lineData.foldedRegion?.let { fRegion ->
val linesWithComments = state?.linesWithComments ?: return@let false
val (frStart, frEnd) = with(editor.document) {
getLineNumber(fRegion.startOffset) to getLineNumber(fRegion.endOffset)
}
(frStart..frEnd).any { line -> line in linesWithComments }
} ?: false
if (hasCommentsInFoldedRegion) return
val rawIcon = if (lineData.columnHovered) AllIcons.General.InlineAddHover else AllIcons.General.InlineAdd
val icon = EditorUIUtil.scaleIcon(rawIcon, editor)
val y = lineData.yRangeWithInlays.first + yShift + (editor.lineHeight - icon.iconHeight) / 2