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

Add option to show completion at start on Prompt.Input() #100

Merged
merged 1 commit into from
Oct 23, 2018

Conversation

rhysd
Copy link
Contributor

@rhysd rhysd commented Oct 18, 2018

I'm using this library for Prompt.Call to choose one from several candidates.

The pain point for me was no completion window is not shown at start. Users cannot notice that it supports completion until they input first character. However, in context where users choose one of candidates, they need to know what character should be input at first. However they can't since there is no candidate shown at start.

So I added one small option OptionShowCompletionAtStart to show completion just after starting selection, which is disabled by default. I could not add any test for this since there is no test for prompt.Input and prompt.Option*.

I've just started to use this library. So it may be possible to do that without adding a new option. In the case, I'll be happy if you kindly tell how to do that.

@c-bata
Copy link
Owner

c-bata commented Oct 23, 2018

Sounds reasonable and enough simple to merge this 👍

Hopefully, options are used as unified regardless of using prompt.Input or prompt.Run. So I think it's better to add if p.completion.showAtStart { p.completion.Update(*p.buf.Document()) } before following line if there isn't something reason why you didn't add this.

p.renderer.Render(p.buf, p.completion)

@rhysd
Copy link
Contributor Author

rhysd commented Oct 23, 2018

Sure. I'll update this branch. Thank you for your review.

@rhysd
Copy link
Contributor Author

rhysd commented Oct 23, 2018

I updated my patch by ammending the first commit. I also rebased this branch onto the latest master.

@c-bata
Copy link
Owner

c-bata commented Oct 23, 2018

Thanks. I confirmed this works fine.

@c-bata c-bata merged commit e577a13 into c-bata:master Oct 23, 2018
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.

2 participants