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

Add an API for customizing the return key in TextEdit #4085

Merged
merged 3 commits into from
Mar 25, 2024

Conversation

lemon-sh
Copy link
Contributor

@lemon-sh lemon-sh commented Feb 21, 2024

This PR allows customizing the return key in the TextEdit widget. Right now, it's hard-coded to the Enter key, which is problematic in cases when you want to use the Enter key for something else, and insert the newline in a different way instead.

@lemon-sh lemon-sh marked this pull request as ready for review February 21, 2024 14:14
/// This combination will cause a newline on multiline,
/// whereas on singleline it will cause the widget to lose focus.
#[inline]
pub fn return_key(mut self, return_key: KeyboardShortcut) -> Self {
Copy link
Owner

Choose a reason for hiding this comment

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

I think this should be called newline_key instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that was also my first idea, but in the single line mode there is no newline involved at all, so it didn't feel right

@emilk emilk added the egui label Mar 12, 2024
@emilk emilk merged commit ab6c3f9 into emilk:master Mar 25, 2024
20 checks passed
@emilk
Copy link
Owner

emilk commented Mar 25, 2024

Thanks!

@lemon-sh lemon-sh deleted the textedit-return-key branch March 25, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants