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

Event handling #15

Open
lukesutton opened this issue May 26, 2021 · 1 comment
Open

Event handling #15

lukesutton opened this issue May 26, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@lukesutton
Copy link
Owner

We want to add event handling to the library — both keyboard and mouse — in which case we need to be able to identify precisely where the views are located within the terminal. Essentially this is the Rect passed to the render method of each view, but for some views — like text inputs — it may be a constrained portion of that Rect.

Views should be:

  • identifiable in some way, though not necessarily stably across renders
  • able to optionally identify a constrained portion of their dimensions
  • able to register handlers for events

These things will add some overhead, so should only occur when strictly necessary i.e. when event handlers are registered.

@lukesutton lukesutton added the enhancement New feature or request label May 26, 2021
@lukesutton
Copy link
Owner Author

The next question is; how will events be propagated to the user's code? So for a given render they pass to a terminal instance, how to they get events?

One idea is to have the View trait define an — optional — message type, and the call to terminal.render() returns a subscription of those messages. So views return the events they want to subscribe to, and handlers to convert those into messages. The terminal subscription is used to propagate them to user code. Maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant