diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/ScrollableSingleRowLayout.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/ScrollableSingleRowLayout.java index 9a032698a10f..afc6a014f825 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/ScrollableSingleRowLayout.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/ScrollableSingleRowLayout.java @@ -104,7 +104,8 @@ public class ScrollableSingleRowLayout extends SingleRowLayout { length = getStrategy().getLengthIncrement(label.getPreferredSize()); final int moreRectSize = getStrategy().getMoreRectAxisSize(); if (data.position + length > data.toFitLength - moreRectSize) { - super.applyTabLayout(data, label, data.toFitLength - data.position - moreRectSize - 4, deltaToFit); + final int clippedLength = getStrategy().drawPartialOverflowTabs() ? data.toFitLength - data.position - moreRectSize - 4 : 0; + super.applyTabLayout(data, label, clippedLength, deltaToFit); label.setAlignmentToCenter(false); label.setActionPanelVisible(false); return false; diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayoutStrategy.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayoutStrategy.java index ac2eaddae2a6..d5a0abf41418 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayoutStrategy.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/singleRow/SingleRowLayoutStrategy.java @@ -73,6 +73,13 @@ public abstract class SingleRowLayoutStrategy { public abstract boolean isDragOut(TabLabel tabLabel, int deltaX, int deltaY); + /** + * Whether a tab that didn't fit completely on the right/bottom side in scrollable layout should be clipped or hidden altogether. + * + * @return true if the tab should be clipped, false if hidden. + */ + public abstract boolean drawPartialOverflowTabs(); + abstract static class Horizontal extends SingleRowLayoutStrategy { protected Horizontal(final SingleRowLayout layout) { super(layout); @@ -129,6 +136,10 @@ public abstract class SingleRowLayoutStrategy { return data.insets.left; } + @Override + public boolean drawPartialOverflowTabs() { + return true; + } } static class Top extends Horizontal { @@ -287,6 +298,10 @@ public abstract class SingleRowLayoutStrategy { return myTabs.myHeaderFitSize.width; } + @Override + public boolean drawPartialOverflowTabs() { + return false; + } } static class Left extends Vertical {