haskell / haskell/haskeline

RFE: clearInput?

Open
#178 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
247
Forks
82
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.