From ea5b3728a5bae1b368620f816be8bb80ffacdcb6 Mon Sep 17 00:00:00 2001 From: mitchell Date: Mon, 4 May 2026 00:05:37 -0400 Subject: [PATCH] feat: wrap TTS output text to terminal width --- tts.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tts.ts b/tts.ts index 0ee0b0f..d14078d 100644 --- a/tts.ts +++ b/tts.ts @@ -69,12 +69,14 @@ for await (const line of koko.stdout) { first = false; const stop = Date.now(); const duration = ((stop - start) / 1000).toFixed(2); - console.log(chalk.blue(`\nTime-to-audio: ${duration}s`)); + console.log(chalk.green(`\nTime-to-audio: ${duration}s`)); } for (const info of infos) { + const [columns] = process.stdout.getWindowSize(); + const text = Bun.wrapAnsi(info.text, columns); const file = `${home}/.ttsc/${info.file}.wav`; - console.log(`\n${chalk.blue(file)}:\n${info.text}\n`); + console.log(`\n${chalk.blue(file)}:\n${text}\n`); if (!wait) { await Bun.spawn({