From dd9aab01cca9cbe60f81ba0c75000ce189ab6e69 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 28 Sep 2024 22:21:11 +0200 Subject: [PATCH] fix(prompt): increase buffer size of input prompts for nodejs to allow paste of more than 8 chars (#739) Co-authored-by: Benjamin Fischer Co-authored-by: Benjamin Fischer <61995275+c4spar@users.noreply.github.com> --- prompt/_generic_prompt.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prompt/_generic_prompt.ts b/prompt/_generic_prompt.ts index 15b68e0d..4e84631b 100644 --- a/prompt/_generic_prompt.ts +++ b/prompt/_generic_prompt.ts @@ -1,5 +1,6 @@ import type { Cursor } from "@cliffy/ansi/cursor-position"; import { type Tty, tty } from "@cliffy/ansi/tty"; +import { getRuntimeName } from "@cliffy/internal/runtime/runtime-name"; import { type KeyCode, parse } from "@cliffy/keycode"; import { bold, @@ -363,7 +364,7 @@ export abstract class GenericPrompt< /** Read user input from stdin. */ #readChar = async (): Promise => { - const buffer = new Uint8Array(8); + const buffer = new Uint8Array(getRuntimeName() === "deno" ? 8 : 4096); const isTty = this.settings.reader.isTerminal(); if (isTty) {