Closed btakita closed 7 years ago
@mokkabonna Would you be able to review and merge this?
I need it for https://github.com/sindresorhus/fkill-cli/issues/8.
Will review and merge today if all ok and no questions.
This PR makes the input appear above the question, that could be misunderstood. It also still causes leftover artifacts if ctrl+c is pressed.
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.
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:
Is there any way to do some cleanup before exit if a ctrl + c? and then render an empty list? Anyone?
@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
It is. Node.js 4.3.0. OS X Terminal.app. Note that I used Inquirer 0.12.0 (latest), not 0.11.4.
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?
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:
Closing this as I now use inquirer@3.0.1
If you want open a new PR to fix the leftover when interrupted. I haven't been able to successfully fix that.
all tests pass. please review