Skip to content

Build your personal knowledge base with Trilium Notes

fix(tab-row): Fix extra +1 when extraWidthRemaining is a decimal

SiriusXT537ad1c1e545
diff --git a/apps/client/src/widgets/tab_row.ts b/apps/client/src/widgets/tab_row.ts
index 26da432c25..6e212f6f68 100644
--- a/apps/client/src/widgets/tab_row.ts
+++ b/apps/client/src/widgets/tab_row.ts
@@ -510,11 +510,11 @@ export default class TabRowWidget extends BasicWidget {
let extraWidthRemaining = totalExtraWidthDueToFlooring;
for (let i = 0; i < numberOfTabs; i += 1) {
- const extraWidth = flooredClampedTargetWidth < TAB_CONTAINER_MAX_WIDTH && extraWidthRemaining > 0 ? 1 : 0;
+ const extraWidth = flooredClampedTargetWidth < TAB_CONTAINER_MAX_WIDTH && extraWidthRemaining >= 1 ? 1 : 0;
widths.push(flooredClampedTargetWidth + extraWidth);
- if (extraWidthRemaining > 0) {
+ if (extraWidthRemaining >= 1) {
extraWidthRemaining -= 1;
}
}