You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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?
The text was updated successfully, but these errors were encountered: