diff --git a/src/webview/columns/data-column.tsx b/src/webview/columns/data-column.tsx index 9e76d3d..63b5d79 100644 --- a/src/webview/columns/data-column.tsx +++ b/src/webview/columns/data-column.tsx @@ -143,13 +143,19 @@ export namespace DataColumn { const groupsPerRowFit = Math.floor(fittingCharacters / wordsPerGroupCharacters); if (groupsPerRowFit > 1) { - // Include other necessary calculations such as margins - const marginRights = (groupsPerRowFit - 1) * Styles.MARGIN_RIGHT_PX; - // Final width if we would render it - const finalWidth = characterWidth * wordsPerGroupCharacters * groupsPerRowFit + marginRights; - const isFit = finalWidth <= columnWidth; - // Take the groups per row or return a group smaller - return isFit ? groupsPerRowFit : groupsPerRowFit - 1; + for (let check = groupsPerRowFit; check > 0; check--) { + // Include other necessary calculations such as margins + const marginRights = (check - 1) * Styles.MARGIN_RIGHT_PX; + // Final width if we would render it + const finalWidth = characterWidth * wordsPerGroupCharacters * check + marginRights; + const isFitting = finalWidth <= columnWidth; + // Take the groups per row if it fits + if (isFitting) { + return check; + } + } + + return 1; } return groupsPerRowFit;