Skip to content

refactor input handling #47

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

refactor input handling #47

wants to merge 1 commit into from

Conversation

afgTheCat
Copy link

Hey,

I tried implementing my feature in impala, but I had a hard time navigating input handling. I noticed that most of the branching logic depends on the Mode, KeyEvent and FocusedBlock, so I refactored input handling to use a match on the tuple containing these. As a result I could get rid of many tabs & roughly 100 loc. I understand that this solution is far from perfect, but I believe that it makes navigating the code much easier. I also did not test every feature meticulously (yet) so please don't merge this pr yet. Let me know what you think, and if you have some improvements in mind.

@afgTheCat afgTheCat changed the title refactor handler refactor input handling Aug 5, 2025
@pythops
Copy link
Owner

pythops commented Aug 5, 2025

I agree that the handler was not really in a good shape but I am not sure these changes make it simpler to be honest.
Maybe a simple way to would be to have 2 functions (as you did for handle_reset_mode_key_event) for Station and AP mode. What do you think ? I am open too for a chat in Discord if you want to discuss it

@afgTheCat
Copy link
Author

Yap I am open to chat. Will message you there.

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

Successfully merging this pull request may close these issues.

2 participants