Repository: flutter
Issue: UndoHistoryController does not function properly in languages like Japanese where characters are confirmed when typed.
Labels: a: text input,f: material design,a: internationalization,has reproducible steps,P2,found in release: 3.13,found in release: 3.14,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

1. Input "あ"
2. Confirm text
3. Input "い"
4. Confirm text
5. Press undo
6. Press undo again

### Expected results

textformfield is empty

### Actual results

"あ" remains in textformfield and "い" blinks when the undo button is pressed.

### Code sample

<details><summary>Code sample</summary>

```dart
class SamplePage extends StatefulWidget {

  SamplePage(): super();

  @override
  SamplePageState createState() => SamplePageState();
}

class SamplePageState extends State<SamplePage> with WidgetsBindingObserver {

  final UndoHistoryController _undoController = UndoHistoryController();

  @override
  void initState() {
    super.initState();  
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          const SizedBox(height: 150,),
          TextFormField(
            maxLines:null, 
            undoController: _undoController,
          ),
          ElevatedButton(
            onPressed: (){
              _undoController.undo();
              setState(() { });
            }, 
            child: const Text("undo")
          )
        ]
      ),
    );

  }

}

```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

![untitled](https://github.com/flutter/flutter/assets/7422251/abeff536-de28-45e3-a8ec-f1857f1fd4ea)


</details>


### Logs

<details><summary>Logs</summary>

```console
It's too long to post, so if you need it, please leave a comment.
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[√] Flutter (Channel master, 3.14.0-14.0.pre.210, on Microsoft Windows [Version 10.0.22621.2215], locale ja-JP)
    • Flutter version 3.14.0-14.0.pre.210 on channel master at C:\Users\81708\Desktop\develop\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 0d9ea62756 (7 hours ago), 2023-09-10 18:34:24 -0400
    • Engine revision 04d836f695
    • Dart version 3.2.0 (build 3.2.0-134.0.dev)
    • DevTools version 2.27.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\81708\AppData\Local\Android\sdk
    • Platform android-33, build-tools 31.0.0
    • Java binary at: C:\Program Files\Android\Android Studio1\jre\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\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2021.3)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • 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.82.0)
    • VS Code at C:\Users\81708\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.72.0

[√] Connected device (4 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Windows (desktop)       • windows       • windows-x64    • Microsoft Windows [Version 10.0.22621.2215]
    • Chrome (web)            • chrome        • web-javascript • Google Chrome 116.0.5845.180
    • Edge (web)              • edge          • web-javascript • Microsoft Edge 116.0.1938.76

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>