-
Notifications
You must be signed in to change notification settings - Fork 6k
[Linux - TextInput] Do not add new line for send action #41895
[Linux - TextInput] Do not add new line for send action #41895
Conversation
| case GDK_KEY_ISO_Enter: | ||
| if (priv->input_type == kFlTextInputTypeMultiline) { | ||
| if (priv->input_type == kFlTextInputTypeMultiline && | ||
| strcmp(priv->input_action, kFlTextInputActionSend) != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we rather compare to "TextInputAction.newline" because it's probably the only text input action that should insert "\n"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems to make sense to me after looking through all of the other TextInputAction values. That's also the default for multiline fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we rather compare to "TextInputAction.newline" because it's probably the only text input action that should insert "\n"?
I wanted to be as conservative as possible because I'm not sure about the meaning of all the TextInputAction values on desktop.
But I agree that it would make sense to insert "\n" only when action is TextInputAction.newline.
@justinmc Can you confirm it would be preferable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree 👍. So to be specific, I think you should keep the multiline check, and instead of checking that it's not kFlTextInputActionSend, check that it is the newline action.
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Will the solution be basically the same on all of the other platforms?
CC @cbracken in case you or anyone else more familiar with the engine wants to take a look.
| case GDK_KEY_ISO_Enter: | ||
| if (priv->input_type == kFlTextInputTypeMultiline) { | ||
| if (priv->input_type == kFlTextInputTypeMultiline && | ||
| strcmp(priv->input_action, kFlTextInputActionSend) != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems to make sense to me after looking through all of the other TextInputAction values. That's also the default for multiline fields.
| static constexpr char kMultilineInputType[] = "TextInputType.multiline"; | ||
| static constexpr char kNoneInputType[] = "TextInputType.none"; | ||
|
|
||
| static constexpr char kFlTextInputActionSend[] = "TextInputAction.send"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Maybe kSendInputType in order to align with the other input type constants above?
Yes. I have a PR almost ready for macOS. I worked on something similar for Flutter Web months ago. And I looked quickly at the Windows implementation, it is very similar. The main work here is to write the platform specific test. So the main point is to agree if we want to add '\n' only for multiline text field with |
jpnurmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice - thanks for the fix @bleroux!
…126624) flutter/engine@748ef96...ef5c349 2023-05-11 [email protected] [Linux - TextInput] Do not add new line for send action (flutter/engine#41895) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…#41977) ## Description This PR updates the macOS text input plugin to avoid adding a new line on a multiline text field when action is not set to `TextInputAction.newline`. ## Related Issue macOS implementation for flutter/flutter#125879. (similar to the Linux implementation in #41895). ## Tests Adds 2 tests.
…lutter#126624) flutter/engine@748ef96...ef5c349 2023-05-11 [email protected] [Linux - TextInput] Do not add new line for send action (flutter/engine#41895) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…ne (#42244) ## Description This PR updates the Windows text input plugin to avoid adding a new line on a multiline text field when action is not set to `TextInputAction.newline`. ## Related Issue Fixes flutter/flutter#125879 as Linux and macOS implementations are merged. Linux PR: #41895 macOS PR: #41977 ## Tests Adds 2 tests.
Description
This PR updates the Linux text input plugin to avoid adding a new line on a multiline text field when action is not set to
TextInputAction.newline.Related Issue
Linux implementation for flutter/flutter#125879
Tests
Adds 1 test.