Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate output when more than 1 line (fixes #153) #168

Merged
merged 12 commits into from
Jul 5, 2019

Conversation

elie-g
Copy link
Contributor

@elie-g elie-g commented Jun 22, 2019

Fixes #153

Note: don't merge yet. I'll check the other prompt types too...


Update: I've fixed the other prompt types. You can merge if you want.

@elie-g
Copy link
Contributor Author

elie-g commented Jun 22, 2019

Prompt Type Needs A Fix Done
Autocomplete Y Y
Confirm Y Y
Date Y Y
Invisible N Y
List N Y
Multiselect Y Y
Number Y Y
Password N Y
Select Y Y
Text N Y
Toggle Y Y

@elie-g
Copy link
Contributor Author

elie-g commented Jun 23, 2019

Done!

@terkelg
Copy link
Owner

terkelg commented Jun 23, 2019

Thank you dude! This is a big one

@terkelg terkelg requested a review from lumio June 23, 2019 16:48
Copy link
Owner

@terkelg terkelg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good - once again thank you

@@ -12,7 +12,7 @@ const color = require('kleur');
* @param {Stream} [opts.stdout] The Writable stream to write readline data to
*/
class Prompt extends EventEmitter {
constructor(opts={}) {
constructor(opts = {}) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is some auto-formatting going on. Should we introduce something like prettier to avoid this in the future?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be a good idea ... this would also allow to unify the code style

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

* @param {Function} [opts.validate] Function to validate the submitted value
* @param {Stream} [opts.stdin] The Readable stream to listen to
* @param {Stream} [opts.stdout] The Writable stream to write readline data to
* @param {Number} [opts.initial] Index
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the formatting here? Maybe it's a bug on GitHub?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed! Don't know why it did that. My formatting settings are setted so my IDE should not even touch the comments. That's weird.

lib/util/ansi.js Outdated
@@ -0,0 +1,8 @@
'use strict';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this to sister-ansi instead?

Copy link
Contributor Author

@elie-g elie-g Jul 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's also what I was thinking so I've already created a PR for that on sisteransi. 😉

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I somehow missed that. It's merged now!

@lumio
Copy link
Collaborator

lumio commented Jun 30, 2019

Other than the code style issue, everything looks fine :)

@terkelg
Copy link
Owner

terkelg commented Jul 2, 2019

Hyped to get this one published. I have merged your sisteransi PR in terkelg/sisteransi#4 and published a new version. It should be ready to be used in Prompts

@elie-g
Copy link
Contributor Author

elie-g commented Jul 4, 2019

I just realised that in the index.js file of sisteransi, the constant ESC is not really the ANSI's escape character but the CSI (Control Sequence Introducer). So actually the save and restore does not work cause they are not part of the control sequences. I'm fixing this.

https://github.com/terkelg/sisteransi/blob/a13a7e755f6dc657f556e5178489446dc1f5494b/src/index.js#L3


Update: I've already updated package.json so it works with the next version of sisteransi which should be 1.0.2. That's probably why travis fails.

@elie-g
Copy link
Contributor Author

elie-g commented Jul 4, 2019

I fixed sisteransi but I noticed something else... (See the note in the PR)

@terkelg terkelg merged commit 6b1c4ab into terkelg:master Jul 5, 2019
@terkelg
Copy link
Owner

terkelg commented Jul 5, 2019

Awesome! 🚀
Let's make sure the master branch is working correctly before we release a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using select with message longer than terminal width duplicates the message.
3 participants