Repository: flutter
Issue: Removing wrong letters in right-to-left texts
Labels: a: text input,framework,a: internationalization,has reproducible steps,P2,found in release: 3.16,found in release: 3.18,team-text-input

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

Type rtl text to multiline textfield :
(DO NOT COPY AND PASTE)

بابا آب داد
با مهربانی
4طتانا جمعا 4واتا +یکسوییت 20متری
بنبابا 40ساله

### Expected results

The letter to the right of the cursor should be deleted.
(It should be noted that when I copy the text from above and paste it in the text field, everything works correctly.)

https://github.com/flutter/flutter/assets/32570964/b3d09305-3b20-4388-b938-2ce451217a79



### Actual results

But when I type the rtl text , the letter on the left side of the cursor is deleted.

https://github.com/flutter/flutter/assets/32570964/31f9ee2d-3aeb-441a-8568-97dcf7fdefe7



### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      locale: const Locale("ar"),
      localizationsDelegates: const [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: const [Locale("ar")],
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: const Center(
        child: Padding(
          padding: EdgeInsets.all(16),
          child: TextField(
            maxLines: 1000,
          ),
        ),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

https://github.com/flutter/flutter/assets/32570964/d06fc103-aca5-4df4-8242-fdc400247346

</details>


### Logs

<details><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[√] Flutter (Channel stable, 3.16.2, on Microsoft Windows [Version 10.0.19045.3636], locale en-US)
    • Flutter version 3.16.2 on channel stable at C:\Flutter\SDK
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9e1c857886 (3 days ago), 2023-11-30 11:51:18 -0600
    • Engine revision cf7a9d0800
    • Dart version 3.2.2
    • DevTools version 2.28.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Program Files\Android\Sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_SDK_ROOT = C:\Program Files\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.0)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.8.34309.116
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2022.3)
    • 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 17.0.6+0-b2043.56-10027231)

[√] VS Code, 64-bit edition (version 1.70.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.54.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.3636]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 113.0.5672.93
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 119.0.2151.58

[√] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>