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

Assorted tweaks to Input #2743

Merged
merged 3 commits into from
Jun 6, 2023
Merged

Assorted tweaks to Input #2743

merged 3 commits into from
Jun 6, 2023

Conversation

davep
Copy link
Contributor

@davep davep commented Jun 6, 2023

A followup to #2737 where, while I was in the code, I saw a couple of things that could be cleaned up (in terms of taking on newer approaches we've adopted) and also the chance to eliminate what very much looks like a wee bit of dead code (#2742).

On the latter point, as mentioned in the linked issue that I'd made as reminder for myself, all evidence suggests that that code was handling a situation that seems to no longer be possible in Textual (seeing keys bound to an action in an on_key handler). Removing this code makes zero difference to the Input unit tests, and hand-testing (in the demo for example, where we have plain and also password inputs) shows zero ill-effects too.

The other tweak here is to make the watchers "private". Once #2708 lands there's likely a couple of similar changes can be made elsewhere here too.

davep added 3 commits June 6, 2023 10:41
Also remove the parameter that wasn't being used anyway.
The branch being removed here seems to be trying to handle keyboard bindings
before handling the raw keyboard event. However, in the unit tests, even
when a binding is pressed, this code doesn't get called.

I strongly suspect this is code that predates changes that were made some
time ago in respect to the order in which bindings were processed and their
relationship to keystrokes.

After removing this all tests are passing just fine and hand-testing
`Input` (especially in the demo, for example, both non-password and password
incarnations) shows no problems either.

All evidence suggests that Textualize#2737 was incapable of hitting that branch of
code because it just could not be hit these days.
@davep davep self-assigned this Jun 6, 2023
@davep davep linked an issue Jun 6, 2023 that may be closed by this pull request
@davep davep merged commit b318d32 into Textualize:main Jun 6, 2023
@davep davep deleted the input-tweaks branch June 6, 2023 10:22
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.

Possible dead code in Input._on_key -- need to check
2 participants