Alternative to Inquirer Prompt for Multi-line Text Input #1583
-
|
Is there an alternative to the Inquirer prompt that supports multi-line text input, without requiring the editor type option? I'm looking for a simple input prompt. For example, if the prompt type is set to input, and I paste a multi-line text like: the prompt only captures "this is" and stops there, instead of recognizing the full text: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Hey @Kairu-bit, I'd really like the input prompt to allow inline multiline. But I think we're limited by how readline work. If you look at the Node.js documentation example: import * as readline from 'node:readline/promises';
import { stdin as input, stdout as output } from 'node:process';
const rl = readline.createInterface({ input, output });
const answer = await rl.question('What do you think of Node.js? ');
console.log(`Thank you for your valuable feedback: ${answer}`);
rl.close();You'll see any press of I'd be happy to work around this if we find a clever way. |
Beta Was this translation helpful? Give feedback.
-
|
Interestingly, I've seen this today in a Go library. It'd be sick to have a similar version within Inquirer https://github.com/charmbracelet/bubbles#text-area |
Beta Was this translation helpful? Give feedback.
-
process.stdin.setRawMode(true);This is a good idea, but adding support for special characters will take extra effort (\u0003 for Ctrl+C, \r for Enter, etc.). |
Beta Was this translation helpful? Give feedback.
Hey @Kairu-bit, I'd really like the input prompt to allow inline multiline. But I think we're limited by how readline work.
If you look at the Node.js documentation example:
You'll see any press of
enterwill trigger the line event.I'd be happy to work around this if we find a clever way.