Skip to content

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