IJPL-157156 Make the editor tabs at least as high as tool window headers

Not clear what caused this regression, but there's an easy way to both
fix it and prevent it. We just need to make sure that the editor tabs
are always at least as high as tool window headers.

The only trick is that the height is calculated in JBTabsImpl, which
is used not just for the editor tabs. So we add an internal protected
method here and override it in the editor tabs only.

GitOrigin-RevId: 106860cf0eb9ff8f0acd3c2121a061b16e0fb301
This commit is contained in:
Sergei Tachenov
2024-07-22 17:17:31 +03:00
committed by intellij-monorepo-bot
parent aee98a59cf
commit 30808bab6e
2 changed files with 16 additions and 1 deletions

View File

@@ -2167,13 +2167,24 @@ open class JBTabsImpl internal constructor(
private fun computeHeaderFitSize(): Dimension {
val max = computeMaxSize()
if (tabsPosition == JBTabsPosition.top || tabsPosition == JBTabsPosition.bottom) {
return Dimension(size.width, if (horizontalSide) max(max.label.height, max.toolbar.height) else max.label.height)
return Dimension(
size.width,
if (horizontalSide) {
max(max.label.height, max.toolbar.height).coerceAtLeast(minHeaderHeight())
}
else {
max.label.height
}
)
}
else {
return Dimension(max.label.width + if (horizontalSide) 0 else max.toolbar.width, size.height)
}
}
@Internal
protected open fun minHeaderHeight(): Int = 0
fun layoutComp(componentX: Int, componentY: Int, component: JComponent, deltaWidth: Int, deltaHeight: Int): Rectangle {
return layoutComp(
bounds = Rectangle(componentX, componentY, width, height),

View File

@@ -64,6 +64,7 @@ import com.intellij.util.ui.TimedDeadzone
import com.intellij.util.ui.UIUtil
import kotlinx.coroutines.*
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.ApiStatus.Internal
import java.awt.*
import java.awt.datatransfer.DataFlavor
import java.awt.datatransfer.Transferable
@@ -592,6 +593,9 @@ private class EditorTabs(
override fun getEditorWindow(): EditorWindow = window
@Internal
override fun minHeaderHeight(): Int = JBUI.CurrentTheme.ToolWindow.headerHeight()
override fun createRowLayout(): TabLayout {
if (!isSingleRow || (isHorizontalTabs && (TabLayout.showPinnedTabsSeparately() || !UISettings.getInstance().hideTabsIfNeeded))) {
return when {