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

This PR fixes a bug with select all (CMD + A on MacOS) when using a text_input. #605

Merged
merged 2 commits into from Nov 25, 2020

Conversation

ZakisM
Copy link
Contributor

@ZakisM ZakisM commented Nov 9, 2020

This PR fixes a bug with select all (CMD + A on MacOS) when using a text_input.

Previous behaviour: when selecting all (CMD + A) would delete the current text inside the input and replace the content with just the letter 'a'.

Now we check if the logo key (modifier key) has been pressed before checking any other key and save it to the state level. This way we can prevent any text being deleted when using the select all shortcut or text being entered at all when a modifier key is pressed (this behaviour matches other text input behaviour i.e text inputs in the browser etc...).

…ext_input.

Previous behaviour: when selecting all (CMD + A) would delete the current text inside the input and replace the content with just the letter 'a'.

Now we check if the logo key (modifier key) has been pressed before checking any other key and save it to the state level. This way we can prevent any text being deleted when using the select all shortcut or text being entered at all when a modifier key is pressed (this behaviour matches other text input behaviour i.e text inputs in the browser etc...).
@hecrj hecrj added the bug Something isn't working label Nov 25, 2020
@hecrj hecrj added this to the 0.2.0 milestone Nov 25, 2020
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.

Thanks!

I have rebased and replaced the is_logo_pressed with a keyboard::ModifiersState instead. This should be more future-proof, as the modifiers field in the key events will eventually be removed.

Let me know what you think, and we can merge this!

@ZakisM
Copy link
Contributor Author

ZakisM commented Nov 25, 2020

Yep looks good. Happy for it to be merged, thanks.

@hecrj hecrj merged commit 18aa14c into iced-rs:master Nov 25, 2020
@ZakisM ZakisM deleted the text_input_select_all_fix branch May 11, 2021 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants