mokkabonna / inquirer-autocomplete-prompt

Autocomplete prompt for inquirer
ISC License
354 stars 82 forks source link

inquirer 0.11.x compatibility #14

Closed btakita closed 7 years ago

btakita commented 8 years ago

all tests pass. please review

sindresorhus commented 8 years ago

@mokkabonna Would you be able to review and merge this?

I need it for https://github.com/sindresorhus/fkill-cli/issues/8.

mokkabonna commented 8 years ago

Will review and merge today if all ok and no questions.

mokkabonna commented 8 years ago

This PR makes the input appear above the question, that could be misunderstood. It also still causes leftover artifacts if ctrl+c is pressed.

image

I am not that familiar with the console and the cursor, but to me it seems the only way to make sure this don't happen is to make the input come at the bottom.

image

Both images show a prompt cancelled with ctrl+c

I would prefer to keep the input at the top, but if not possible, I think placing it at the bottom is the best alternative.

It also happen with the input prompt that renders an error below the cursor (like I render the list below it) if I render a multiline error:

image

Is there any way to do some cleanup before exit if a ctrl + c? and then render an empty list? Anyone?

mokkabonna commented 8 years ago

@sindresorhus what node do you have, could you confirm that the leftover text issue actually is gone with this PR? I do not see it gone as stated above.

What node do you have? I have v4.3.1

And this installed

inquirer-autocomplete-prompt@0.1.3 /home/martin/projects/inquirer-autocomplete-prompt
├─┬ chalk@1.1.1
│ ├─┬ ansi-styles@2.2.0
│ │ └── color-convert@1.0.0
│ ├── escape-string-regexp@1.0.5
│ ├─┬ has-ansi@2.0.0
│ │ └── ansi-regex@2.0.0
│ ├─┬ strip-ansi@3.0.1
│ │ └── ansi-regex@2.0.0
│ └── supports-color@2.0.0
├── figures@1.4.0
├─┬ inquirer@0.11.4
│ ├── ansi-escapes@1.1.1
│ ├── ansi-regex@2.0.0
│ ├─┬ cli-cursor@1.0.2
│ │ └─┬ restore-cursor@1.0.1
│ │   ├── exit-hook@1.1.1
│ │   └── onetime@1.1.0
│ ├── cli-width@1.1.1
│ ├─┬ readline2@1.0.1
│ │ ├─┬ code-point-at@1.0.0
│ │ │ └── number-is-nan@1.0.0
│ │ ├─┬ is-fullwidth-code-point@1.0.0
│ │ │ └── number-is-nan@1.0.0
│ │ └── mute-stream@0.0.5
│ ├─┬ run-async@0.1.0
│ │ └─┬ once@1.3.3
│ │   └── wrappy@1.0.1
│ ├── rx-lite@3.1.2
│ ├─┬ string-width@1.0.1
│ │ ├─┬ code-point-at@1.0.0
│ │ │ └── number-is-nan@1.0.0
│ │ └─┬ is-fullwidth-code-point@1.0.0
│ │   └── number-is-nan@1.0.0
│ ├── strip-ansi@3.0.1
│ └── through@2.3.8
├── lodash@3.10.1
├─┬ promise@7.1.1
│ └── asap@2.0.3
└─┬ util@0.10.3
  └── inherits@2.0.1
sindresorhus commented 8 years ago

It is. Node.js 4.3.0. OS X Terminal.app. Note that I used Inquirer 0.12.0 (latest), not 0.11.4.

screen shot 2016-02-26 at 15 26 48
mokkabonna commented 8 years ago

Forgot to mention I have linux btw, elementary OS, based on ubuntu 14.04.

Will try with latest inquirer, if it still does not exit without leftover output, then I will probably change the input to be at the bottom. So it works consistently.

Sounds good?

vweevers commented 8 years ago

FIY here's an alternative that:

I have no interest in continuing this branch because I need different behavior for the autocomplete prompt, but it might be of use to you, so :gift:

mokkabonna commented 7 years ago

Closing this as I now use inquirer@3.0.1

mokkabonna commented 7 years ago

If you want open a new PR to fix the leftover when interrupted. I haven't been able to successfully fix that.