Skip to content

RFE: clearInput? #178

@juhp

Description

@juhp

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions