Skip to main content

Tabs & newlines in input.textAsync prompt

  • December 20, 2022
  • 2 replies
  • 11 views

Forum|alt.badge.img+8
What is the proposed idea/solution?

Allow tabs ('\t') and newlines ('\n') in the prompt argument to input.textAsync.

How does is solve the user problems?

Multiline prompts would make longer prompts more readable. The following is, quite frankly, a mess:

How was this validated?

Tabs and newlines in the prompt string are not shown. The above mess is generated by the following code:

 

 

const grps = ['Update Projects entry', 'Topic', 'Database', 'Results', 'Dev build', 'Initial meeting', 'Demo', 'Data sharing', 'Contouring', 'Model development', 'Interim analysis', 'Final analysis', 'Study proposal', 'Study protocol', 'Grant', 'Prospective data collection', 'CRA', 'REB', 'Abstract (will be published on its own)', 'Manuscript', 'Poster', 'Presentation', 'NDA', 'Privacy/security review', 'Cover letter'].sort(); var origPrompt = 'Record group to create. Choose a number.\n'; for(var i = 0; i < grps.length; ++i) { origPrompt += (i + 1) + '.\t' + grps[i] + '\n'; } origPrompt += 'Group number: ' await input.textAsync(origPrompt);

 

 

Who is the target audience?

Users who want more formatting options in scripts, especially for longer text prompts.

-

Note that this wouldn't be an issue if radio button inputs were supported.

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • December 20, 2022

Even though this is a product suggestion, you may be able to get your desired behavior with existing features. 

You can output the details of your prompt using output.markdown() immediately before input.textAsync().

Or, you could use input.buttonsAsync() so that users can push a button for the desired choice without typing anything. 


Forum|alt.badge.img+8
  • Author
  • New Participant
  • December 21, 2022

Actually, output.markdown doesn't work in this case:

 

const grps = ['Update Projects entry', 'Topic', 'Database', 'Results', 'Dev build', 'Initial meeting', 'Demo', 'Data sharing', 'Contouring', 'Model development', 'Interim analysis', 'Final analysis', 'Study proposal', 'Study protocol', 'Grant', 'Prospective data collection', 'CRA', 'REB', 'Abstract (will be published on its own)', 'Manuscript', 'Poster', 'Presentation', 'NDA', 'Privacy/security review', 'Cover letter'].sort(); var origPrompt = 'Record group to create. Choose a number.\n'; for(var i = 0; i < grps.length; ++i) { origPrompt += (i + 1) + '.\t' + grps[i] + '\n'; } output.markdown(origPrompt); // output.markdown(`${origPrompt}`) gives same result await input.textAsync('Group number: ');

 

 

But output.text does:

 

const grps = ['Update Projects entry', 'Topic', 'Database', 'Results', 'Dev build', 'Initial meeting', 'Demo', 'Data sharing', 'Contouring', 'Model development', 'Interim analysis', 'Final analysis', 'Study proposal', 'Study protocol', 'Grant', 'Prospective data collection', 'CRA', 'REB', 'Abstract (will be published on its own)', 'Manuscript', 'Poster', 'Presentation', 'NDA', 'Privacy/security review', 'Cover letter'].sort(); var origPrompt = 'Record group to create. Choose a number.\n'; for(var i = 0; i < grps.length; ++i) { origPrompt += (i + 1) + '.\t' + grps[i] + '\n'; } output.text(origPrompt); await input.textAsync('Group number: ');