From c7418c4594fe50920cb4c94b08087ff1bb681891 Mon Sep 17 00:00:00 2001 From: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:39:31 +0200 Subject: [PATCH] fix: make tag listing table use dynamic column widths to prevent truncation (#1264) Co-authored-by: Ralph Khreish Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> --- .../modules/task-manager/tag-management.js | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/modules/task-manager/tag-management.js b/scripts/modules/task-manager/tag-management.js index c17f7068..a4abd183 100644 --- a/scripts/modules/task-manager/tag-management.js +++ b/scripts/modules/task-manager/tag-management.js @@ -619,9 +619,29 @@ async function tags( headers.push(chalk.cyan.bold('Description')); } + // Calculate dynamic column widths based on terminal width + const terminalWidth = Math.max(process.stdout.columns || 120, 80); + const usableWidth = Math.floor(terminalWidth * 0.95); + + let colWidths; + if (showMetadata) { + // With metadata: Tag Name, Tasks, Completed, Created, Description + const widths = [0.25, 0.1, 0.12, 0.15, 0.38]; + colWidths = widths.map((w, i) => + Math.max(Math.floor(usableWidth * w), i === 0 ? 15 : 8) + ); + } else { + // Without metadata: Tag Name, Tasks, Completed + const widths = [0.7, 0.15, 0.15]; + colWidths = widths.map((w, i) => + Math.max(Math.floor(usableWidth * w), i === 0 ? 20 : 10) + ); + } + const table = new Table({ head: headers, - colWidths: showMetadata ? [20, 10, 12, 15, 50] : [25, 10, 12] + colWidths: colWidths, + wordWrap: true }); // Add rows