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

RFE: clearInput? #178

Open
juhp opened this issue May 25, 2023 · 0 comments
Open

RFE: clearInput? #178

juhp opened this issue May 25, 2023 · 0 comments

Comments

@juhp
Copy link

juhp commented May 25, 2023

I was looking for an easy way to clear stdin before getInputLine.

So I was wondering if it would make sense to add a clearInput function to haskeline.
I don't know how portable that would be or how easy to implement:
perusing the code made me think it could be possible, but complicated for me at least.

For now I did a workaround (which will probably be in simple-prompt-0.1.1) which checks
how little time passed since getInputLine: if it is less that 5ms then I repeat the prompt
hence causing any buffered stdin to be ignored effectively.
Another approach might be not to accept empty input (ie containing only a buffered newline).

On the other hand maybe there is a more natural library for prompt input, which allows editting?
(For my actual current use-case I only need Posix/Linux support, though a portable solution would be best.)

Any thoughts?

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

No branches or pull requests

1 participant