prompts icon indicating copy to clipboard operation
prompts copied to clipboard

Change up/down for number to use initial value

Open jackcannon opened this issue 2 years ago • 0 comments

This is a small change to make the up/down behaviour a little bit more natural.

Use case:

const {xMovement} = await prompts(
  {
    type: 'number',
    name: 'xMovement',
    message: 'How should the asset move horizontally (x)?',
    initial: 0
  }
);

Repro steps

  1. Run above example code
  2. See initial 'grayed out' 0 where value is displayed
  3. Without inputting any new values, press ↑ (up)

Expected result: input value to change in regards to the 0 Actual result: input value is set to -Infinity

New behaviour: pressing ↑ (up) sets the value (cyan) to 0, pressing ↑ (up) again changes the value to 1

Ditto for pressing ↓ (down)

jackcannon avatar Aug 04 '22 00:08 jackcannon