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

Unexpected new line added after pressed Enter when using multi-line TextField with TextInputAction.send #125879

Closed
2 tasks done
simonpham opened this issue May 2, 2023 · 8 comments · Fixed by flutter/engine#42244
Assignees
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems engine flutter/engine repository. See also e: labels. found in release: 3.7 Found to occur in 3.7 found in release: 3.10 Found to occur in 3.10 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version

Comments

@simonpham
Copy link

simonpham commented May 2, 2023

Is there an existing issue for this?

Steps to reproduce

  1. Run the code sample below on macOS.
    (Or setup a TextField with textInputAction: TextInputAction.send and multi-line enabled)
  2. Type something in the TextField
  3. (optional) Change keyboard cursor position to anywhere.
  4. Press Enter

Expected results

onSubmitted or onEditingCompleted is called with no newline (\n) added at the cursor's current position.

Actual results

New line is added before onSubmitted or onEditingCompleted is called.

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: TextField(
            keyboardType: TextInputType.multiline,
            maxLines: null,
            textInputAction: TextInputAction.send,
            onSubmitted: (String? text) {
              debugPrint(text);
            },
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration image

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.7.12, on macOS 13.2.1 22D68 darwin-arm64, locale en-US)
    • Flutter version 3.7.12 on channel stable at /Users/simon/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (2 weeks ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/simon/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Users/simon/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/simon/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Users/simon/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 73.0.4
    • Dart plugin version 231.8770.15

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Users/simon/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8770.65/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.2.1 22D68 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 112.0.5615.137

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
@simonpham
Copy link
Author

simonpham commented May 2, 2023

I found a workaround by not using onSubmitted but onChanged with a check for newline at the end:

onChanged: (text) {
  if (text.isEmpty) {
    return;
  }

  if (!text.endsWith('\n')) {
    return;
  }

  _handleSubmitted(text.trim());
},

But it doesn't work if users want to add one or more new lines at the end.

@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label May 3, 2023
@danagbemava-nc
Copy link
Member

I can reproduce the issue using the code sample provided above only on macOs.

I tested on chrome, android, iOS & macOS.

logs

iOS logs

Waiting for Nexus to connect...
Launching lib/main.dart on Nexus in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: X8NNQ9CYL2
Running Xcode build...
Xcode build done.                                           46.3s
Installing and launching...
(lldb) 2023-05-03 08:52:22.542527+0000 Runner[5947:537512] [VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(35)] Using the Impeller rendering backend.
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
Debug service listening on ws://127.0.0.1:53464/FMZYpEVkedw=/ws
Syncing files to device Nexus...
Successfully load keyboard extensions
flutter: hello darkness my old friend
[Snapshotting] Snapshotting a view (0x11b808200, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES.

macOS

Launching lib/main.dart on macOS in debug mode...
Building macOS application...
2023-05-03 08:58:31.843 xcodebuild[52099:1795536] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00008103-000329201AD1001E }
{ platform:macOS, arch:x86_64, id:00008103-000329201AD1001E }
Debug service listening on ws://127.0.0.1:54055/K9y3rymTMCo=/ws
Syncing files to device macOS...
flutter: hello darkness my old 
flutter: friend

chrome

Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
This app is linked to the debug service: ws://127.0.0.1:54166/OhltTWSTT_U=/ws
Debug service listening on ws://127.0.0.1:54166/OhltTWSTT_U=/ws
Debug service listening on ws://127.0.0.1:54166/OhltTWSTT_U=/ws
hello darkness my old friend
flutter doctor -v
[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E261 darwin-arm64, locale en-GB)
    • Flutter version 3.7.12 on channel stable at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (2 weeks ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode-14.3.0.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9619390/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Users/nexus/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 73.0.4
    • Dart plugin version 231.8770.15

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8109.175/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8770.65/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.77.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.62.0

[✓] Connected device (3 available)
    • Pixel 7 (mobile) • 28291FDH2001SA • android-arm64  • Android 13 (API 33)
    • macOS (desktop)  • macos          • darwin-arm64   • macOS 13.3.1 22E261 darwin-arm64
    • Chrome (web)     • chrome         • web-javascript • Google Chrome 112.0.5615.137

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
[!] Flutter (Channel master, 3.10.0-19.0.pre.31, on macOS 13.3.1 22E261 darwin-arm64, locale en-GB)
    • Flutter version 3.10.0-19.0.pre.31 on channel master at /Users/nexus/dev/sdks/flutters
    ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 110fe75b5d (3 hours ago), 2023-05-03 02:11:35 -0400
    • Engine revision 0407a16a9b
    • Dart version 3.1.0 (build 3.1.0-66.0.dev)
    • DevTools version 2.23.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode-14.3.0.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/221.6008.13.2211.9619390/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Users/nexus/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 73.0.4
    • Dart plugin version 231.8770.15

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8109.175/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8770.65/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.77.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.62.0

[✓] Connected device (3 available)
    • Pixel 7 (mobile) • 28291FDH2001SA • android-arm64  • Android 13 (API 33)
    • macOS (desktop)  • macos          • darwin-arm64   • macOS 13.3.1 22E261 darwin-arm64
    • Chrome (web)     • chrome         • web-javascript • Google Chrome 112.0.5615.137

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

@danagbemava-nc danagbemava-nc added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. platform-mac Building on or for macOS specifically a: desktop Running on desktop has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.7 Found to occur in 3.7 found in release: 3.10 Found to occur in 3.10 and removed in triage Presently being triaged by the triage team labels May 3, 2023
@guchengxi1994
Copy link

windows has the same problem.
Another solution is use RawKeyboardListener

@danagbemava-nc
Copy link
Member

This happens on windows & linux as well. Removing platform-mac label.

flutter doctor -v Linux (stable & master)
[!] Flutter (Channel stable, 3.7.12, on Ubuntu 22.04.1 LTS 5.19.0-38-generic, locale en_US.UTF-8)
    • Flutter version 3.7.12 on channel stable at /home/huynq/Documents/Working/flutter
    ! Warning: `dart` on your path resolves to /usr/lib/dart/bin/dart, which is not inside your current Flutter SDK checkout at /home/huynq/Documents/Working/flutter. Consider adding /home/huynq/Documents/Working/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (6 days ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /home/huynq/Android/Sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /home/huynq/Documents/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2021.1)
    • Android Studio at /home/huynq/Documents/android-studio
    • Flutter plugin version 67.0.1
    • Dart plugin version 211.7817
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.71.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.60.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.1 LTS 5.19.0-38-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 112.0.5615.121

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
[!] Flutter (Channel master, 3.10.0-15.0.pre.28, on Ubuntu 22.04.1 LTS 5.19.0-38-generic, locale en_US.UTF-8)
    • Flutter version 3.10.0-15.0.pre.28 on channel master at /home/huynq/Documents/Working/flutter_master
    ! Warning: `flutter` on your path resolves to /home/huynq/Documents/Working/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /home/huynq/Documents/Working/flutter_master. Consider adding /home/huynq/Documents/Working/flutter_master/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /usr/lib/dart/bin/dart, which is not inside your current Flutter SDK checkout at /home/huynq/Documents/Working/flutter_master. Consider adding /home/huynq/Documents/Working/flutter_master/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4dbeb3fb06 (7 minutes ago), 2023-04-27 11:19:34 -0400
    • Engine revision 381f714972
    • Dart version 3.1.0 (build 3.1.0-49.0.dev)
    • DevTools version 2.23.1
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /home/huynq/Android/Sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /home/huynq/Documents/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2021.1)
    • Android Studio at /home/huynq/Documents/android-studio
    • Flutter plugin version 67.0.1
    • Dart plugin version 211.7817
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.71.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.60.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 22.04.1 LTS 5.19.0-38-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 112.0.5615.121

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
flutter doctor -v windows (stable & master) ​ ```bash [√] Flutter (Channel stable, 3.7.12, on Microsoft Windows [Version 10.0.19045.2846], locale en-US) • Flutter version 3.7.12 on channel stable at C:\WIP\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 4d9e56e (6 days ago), 2023-04-17 21:47:46 -0400 • Engine revision 1a65d409c7 • Dart version 2.19.6 • DevTools version 2.20.1 ​ [√] Windows Version (Installed version of Windows is version 10 or higher) ​ [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at C:\AndroidSDK • Platform android-33, build-tools 33.0.0 • ANDROID_HOME = C:\AndroidSDK • Java binary at: C:\Program Files\Android\Android Studio Electric Eel 2022.1.1\jbr\bin\java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. ​ [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe ​ [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.4) • Visual Studio at D:\DOWNLOADWORK\VS2022 • Visual Studio Community 2022 version 17.4.33213.308 • Windows 10 SDK version 10.0.19041.0 ​ [√] Android Studio (version 2021.2) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) ​ [√] Android Studio (version 2022.1) • Android Studio at C:\Program Files\Android\Android Studio Electric Eel 2022.1.1 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) ​ [√] VS Code (version 1.77.3) • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.62.0 ​ [√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.2846] • Chrome (web) • chrome • web-javascript • Google Chrome 112.0.5615.138 • Edge (web) • edge • web-javascript • Microsoft Edge 111.0.1661.54 ​ [√] HTTP Host Availability • All required HTTP hosts are available ​ • No issues found! ``` ​ ```bash [!] Flutter (Channel master, 3.10.0-12.0.pre.29, on Microsoft Windows [Version 10.0.19045.2846], locale en-US) • Flutter version 3.10.0-12.0.pre.29 on channel master at C:\WIP\flutter_master ! Warning: `flutter` on your path resolves to C:\WIP\flutter\bin\flutter, which is not inside your current Flutter SDK checkout at C:\WIP\flutter_master. Consider adding C:\WIP\flutter_master\bin to the front of your path. ! Warning: `dart` on your path resolves to C:\WIP\flutter\bin\dart, which is not inside your current Flutter SDK checkout at C:\WIP\flutter_master. Consider adding C:\WIP\flutter_master\bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 60077ff (16 hours ago), 2023-04-23 07:09:16 -0400 • Engine revision fcf46af2d3 • Dart version 3.1.0 (build 3.1.0-35.0.dev) • DevTools version 2.23.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. ​ [√] Windows Version (Installed version of Windows is version 10 or higher) ​ [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at C:\AndroidSDK • Platform android-33, build-tools 33.0.0 • ANDROID_HOME = C:\AndroidSDK • Java binary at: C:\Program Files\Android\Android Studio Electric Eel 2022.1.1\jbr\bin\java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. ​ [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe ​ [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.4) • Visual Studio at D:\DOWNLOADWORK\VS2022 • Visual Studio Community 2022 version 17.4.33213.308 • Windows 10 SDK version 10.0.19041.0 ​ [√] Android Studio (version 2021.2) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) ​ [√] Android Studio (version 2022.1) • Android Studio at C:\Program Files\Android\Android Studio Electric Eel 2022.1.1 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) ​ [√] VS Code (version 1.77.3) • VS Code at C:\Users\ADMIN\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.62.0 ​ [√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.2846] • Chrome (web) • chrome • web-javascript • Google Chrome 112.0.5615.138 • Edge (web) • edge • web-javascript • Microsoft Edge 111.0.1661.54 ​ [√] Network resources • All expected network resources are available. ​ ! Doctor found issues in 1 category. ```

@danagbemava-nc danagbemava-nc removed the platform-mac Building on or for macOS specifically label May 4, 2023
@bleroux
Copy link
Contributor

bleroux commented May 4, 2023

I checked on the linux engine, this is the code which adds the new line before performing the action:

https://github.com/flutter/engine/blob/f2e99f0f91fcea9ac5a48327014771e453bea4b0/shell/platform/linux/fl_text_input_plugin.cc#L642-L651

This code does not check if the action is something else than TextInputAction.newLine.

Fixing this at the framework level is possible, but it might be somewhat hacky because the framework would have to remove the \n added by the engine.

@justinmc I'm very interested to get your feedback on whether this should be fix at the framework or engine level?

@gspencergoog
Copy link
Contributor

This should be fixed in the engine. We don't want to introduce more complexity in the framework code, and some embedders might not need the same treatment.

cc @cbracken

@gspencergoog gspencergoog added the P2 Important issues not at the top of the work list label May 4, 2023
@danagbemava-nc danagbemava-nc added engine flutter/engine repository. See also e: labels. and removed framework flutter/packages/flutter repository. See also f: labels. labels May 5, 2023
@bleroux bleroux self-assigned this May 10, 2023
auto-submit bot pushed a commit to flutter/engine that referenced this issue May 13, 2023
…#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.
@simonpham
Copy link
Author

@bleroux thank you for addressing this issue. 🔥

auto-submit bot pushed a commit to flutter/engine that referenced this issue Jun 1, 2023
…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.
@bleroux bleroux added the r: fixed Issue is closed as already fixed in a newer version label Jun 2, 2023
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems engine flutter/engine repository. See also e: labels. found in release: 3.7 Found to occur in 3.7 found in release: 3.10 Found to occur in 3.10 has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list r: fixed Issue is closed as already fixed in a newer version
Projects
Status: Done (PR merged)
Development

Successfully merging a pull request may close this issue.

5 participants