feat: replace full ASCII box w/ only top and bottom to allow copy

This commit is contained in:
jfgreffier 2024-04-07 19:56:27 +02:00
parent a6827772a5
commit eb5eeed1c7

View file

@ -18,9 +18,9 @@ export function wrapInASCIIBox(text: string, padding = 0): string {
const lines = text.split('\n');
const maxLength = Math.max(...lines.map(line => line.length));
return [
'╔' + '═'.repeat(maxLength + padding * 2) + '╗',
...lines.map(line => '║' + ' '.repeat(padding) + line + ' '.repeat(maxLength - line.length + padding) + '║'),
'╚' + '═'.repeat(maxLength + padding * 2) + '╝',
'═'.repeat(maxLength + padding * 2),
...lines.map(line => ' '.repeat(padding) + line + ' '.repeat(maxLength - line.length + padding)),
'═'.repeat(maxLength + padding * 2),
].join('\n');
}