fix: make tag listing table use dynamic column widths to prevent truncation
- Replace hardcoded colWidths with terminal-width-based calculation - Tag Name column now gets 70% width (normal) or 25% width (metadata mode) - Add wordWrap support for better handling of long tag names - Fixes issue where tag names >20 chars were truncated with ellipsis - Users can now see full tag names for use with use-tag command Co-authored-by: Ralph Khreish <Crunchyman-ralph@users.noreply.github.com>
This commit is contained in:
committed by
Ralph Khreish
parent
0747f1c772
commit
ae4c4d9b93
@@ -619,9 +619,32 @@ async function tags(
|
|||||||
headers.push(chalk.cyan.bold('Description'));
|
headers.push(chalk.cyan.bold('Description'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculate dynamic column widths based on terminal width
|
||||||
|
const terminalWidth = process.stdout.columns * 0.95 || 100;
|
||||||
|
|
||||||
|
let colWidths;
|
||||||
|
if (showMetadata) {
|
||||||
|
// With metadata: Tag Name, Tasks, Completed, Created, Description
|
||||||
|
colWidths = [
|
||||||
|
Math.floor(terminalWidth * 0.25), // Tag Name (25%)
|
||||||
|
Math.floor(terminalWidth * 0.1), // Tasks (10%)
|
||||||
|
Math.floor(terminalWidth * 0.12), // Completed (12%)
|
||||||
|
Math.floor(terminalWidth * 0.15), // Created (15%)
|
||||||
|
Math.floor(terminalWidth * 0.38) // Description (38%)
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
// Without metadata: Tag Name, Tasks, Completed
|
||||||
|
colWidths = [
|
||||||
|
Math.floor(terminalWidth * 0.7), // Tag Name (70%)
|
||||||
|
Math.floor(terminalWidth * 0.15), // Tasks (15%)
|
||||||
|
Math.floor(terminalWidth * 0.15) // Completed (15%)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
const table = new Table({
|
const table = new Table({
|
||||||
head: headers,
|
head: headers,
|
||||||
colWidths: showMetadata ? [20, 10, 12, 15, 50] : [25, 10, 12]
|
colWidths: colWidths,
|
||||||
|
wordWrap: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add rows
|
// Add rows
|
||||||
|
|||||||
Reference in New Issue
Block a user