Skip to content

Incorrect caret position with complex scripts #118403

@tgucio

Description

@tgucio

caret

Steps to Reproduce

  1. Execute flutter run on the code sample on a platform with HW keyboard
  2. Traverse the text using arrow left/right keys

Expected results: Caret advances correctly

Actual results: Caret jumps back and forth

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    const TextStyle style = TextStyle(fontSize: 16.0);
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: Center(
        child: Column(
          children: <Widget>[
            const SizedBox(height: 100.0),
            TextField(controller: TextEditingController(text: 'प्राप्त वर्णन प्रव्रुति')),
            const SizedBox(height: 100.0),
          ],
        ),
      ),
    );
  }
}
Logs
% flutter --version
Flutter 3.7.0-20.0.pre.6 • channel master • https://github.com/flutter/flutter.git
Framework • revision f8628b5cb1 (15 hours ago) • 2023-01-11 18:48:03 -0800
Engine • revision 4a8d6866a1
Tools • Dart 3.0.0 (build 3.0.0-112.0.dev) • DevTools 2.20.0

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: desktopRunning on desktopa: internationalizationSupporting other languages or locales. (aka i18n)a: text inputEntering text in a text field or keyboard related problemsf: material designflutter/packages/flutter/material repository.found in release: 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions