You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The value of the default property is not written to the temporary file when waitUserInput is set to false.
Reproduction
Using vi :
importinquirerfrom"inquirer";process.env.EDITOR="vi";constanswer=awaitinquirer.prompt({type: "editor",name: "value",message: "you shouldn't see this unless your message wasn't validated!",default: "replace this with your own message",validate(text){if(!text){return"you have to type something";}returntrue;},waitUserInput: false,});console.log(answer);
Expected Behavior
For vi to open with the given default contents.
Actual Behavior
The opened file is empty (furthermore, the prompt "Press <enter> to launch your preferred editor" is overlaid on top of the editing area).
Cause
The feature introduced in #1150 adds the waitUserInput flag. The implementation can be viewed at this link.
The external editor is opened before the default value can be copied over to this.currentText.
The initial render method is still called even though the external editor is immediately opened.
Proposed Solution
The conditional should be moved after this.currentText is set, and this.render should only be called if waitUserInput is set to true.
The text was updated successfully, but these errors were encountered:
mensah-j
added a commit
to mensah-j/Inquirer.js
that referenced
this issue
May 14, 2024
Description
The value of the
default
property is not written to the temporary file whenwaitUserInput
is set to false.Reproduction
Using
vi
:Expected Behavior
For
vi
to open with the given default contents.Actual Behavior
The opened file is empty (furthermore, the prompt "Press <enter> to launch your preferred editor" is overlaid on top of the editing area).
Cause
The feature introduced in #1150 adds the
waitUserInput
flag. The implementation can be viewed at this link.this.currentText
.Proposed Solution
The conditional should be moved after
this.currentText
is set, andthis.render
should only be called ifwaitUserInput
is set to true.The text was updated successfully, but these errors were encountered: