Skip to content

Peek at input #2888

@coz-eduardo-hernandez

Description

@coz-eduardo-hernandez

Would it be possible to have a function similar to notcurses_get* that peeks at the input, but doesn't remove the input from the event list? So i you call notcurses_get* you'd get the same input.

Maybe also function that removes the next event without getting it (if that allows a function that does less work), since you might have handled the event when peaked at.

The purpose is being able to pass events in a manner similar to many UI systems; the top layer widget receives the input, then passes it down until a widget that can handle the input is reached. However if the last widget is reached and the event hasn't been handled yet, a default handler could do whatever it needs to, maybe handle it or just discard the event from the queue. The default handler should be able to be in a module that's separated from the widgets.

This might be done portably by calling ungetc() on stdin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions