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

Decouple Key from keyboard::Modifiers and apply them to text in KeyboardInput #2238

Merged
merged 2 commits into from
Feb 20, 2024

Conversation

wash2
Copy link
Contributor

@wash2 wash2 commented Feb 5, 2024

Input like "ctrl + [a-z]" produces text like "a" instead of control characters when not accounting for modifiers. For Character keys, in most cases the text from the winit KeyEvent should match the received character anyway, so maybe it would be better to pass the text with modifiers accounted for.

@wash2 wash2 force-pushed the modifiers-text branch 2 times, most recently from 3dca7f1 to 3d4e3d3 Compare February 5, 2024 19:54
@hecrj
Copy link
Member

hecrj commented Feb 11, 2024

I see. What is the use case for this?

It also seems that text_with_all_modifiers is not available on Wasm.

@hecrj hecrj added this to the 0.12.1 milestone Feb 20, 2024
@hecrj hecrj added bug Something isn't working fix labels Feb 20, 2024
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense. I have also decoupled the Key from the keyboard modifiers, since it seems winit doesn't do that by default.

Wasm keeps the old behavior, since the supplement trait isn't implemented there. We'll have to figure out how to keep the API consistent there eventually.

@hecrj hecrj enabled auto-merge February 20, 2024 15:36
@hecrj hecrj changed the title fix: account for modifiers in key text Decouple Key from keyboard::Modifiers and apply them to text in KeyboardInput Feb 20, 2024
@hecrj hecrj merged commit 78dfcfb into iced-rs:master Feb 20, 2024
12 checks passed
@wash2
Copy link
Contributor Author

wash2 commented Feb 20, 2024

I see. What is the use case for this?

It also seems that text_with_all_modifiers is not available on Wasm.

Oh sorry, I did not see this until now 😅 . The control characters are important in a terminal application, like cosmic-term, as an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working change fix shell
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants