Просмотр исходного кода

fix(tui): add bottom padding so input doesn't sit flush at terminal edge

Ma 7 месяцев назад
Родитель
Сommit
4c72b5c063
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      packages/cli/src/tui/app.ts

+ 7 - 0
packages/cli/src/tui/app.ts

@@ -250,9 +250,14 @@ export async function launchTui(
     rl.close();
   };
 
+  const bottomPad = 4;
   const promptInput = () => {
     drawInputTop();
     rl.prompt();
+    // Add padding below prompt so it's not flush with terminal bottom,
+    // then move cursor back up to the prompt line.
+    process.stdout.write("\n".repeat(bottomPad));
+    process.stdout.write(`\x1b[${bottomPad}A`);
   };
 
   process.on("SIGINT", () => {
@@ -267,6 +272,8 @@ export async function launchTui(
   promptInput();
 
   for await (const line of rl) {
+    // Move past the bottom padding, then draw box bottom
+    process.stdout.write(`\x1b[${bottomPad}B`);
     drawInputBottom();
     const input = line.trim();