Skip to content

[Windows] Problem deleting last composing character #92132

Closed
flutter-team-archive/engine
#29396

Description

@justinmc

On Windows, the last composing character either can't be deleted or takes an extra backspace.

  1. Run the app below (anything with a text field) on Windows.
  2. Type some composing text, such as "nihao" with your input set to Chinese pinyin.
  3. Use the backspace key to delete the characters you entered.

Expected: 5 backspaces should delete "nihao"
Actual: The fifth backspace removes the composing region and the sixth deletes the final "n". Or, sometimes I am unable to delete the final letter at all, but I'm not sure how to consistently reproduce that.

Here's a video, but unfortunately it doesn't capture the composing menu.

sandbox.2021-10-19.13-54-21.mp4
Code
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
//import 'package:flutter_localizations/flutter_localizations.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Demo Home Page'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: const <Widget>[
              TextField(),
            ],
          ),
        ),
      ),
    );
  }
}

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    platform-windowsBuilding on or for Windows specifically
    on Oct 19, 2021
  2. added
    P2Important issues not at the top of the work list
    c: regressionIt was better in the past than it is now
    P1High-priority issues at the top of the work list
    a: annoyanceRepeatedly frustrating issues with non-experimental functionality
    and removed
    P2Important issues not at the top of the work list
    on Oct 21, 2021
  3. gspencergoog commented on Oct 21, 2021

    @gspencergoog
    Contributor
  4. dkwingsmt commented on Oct 25, 2021

    @dkwingsmt
    Contributor

    Is it related to #91861 ? It seems that there's a decorational ' that took one backspace to delete. And sometimes there's a discrepancy between states, so that while the actual precomp only had 5 characters (thus allowing 5 Backspaces), the displayed precomp had 6 characters (including the ', thus allowing 6 Backspaces.)

  5. self-assigned this
    on Oct 26, 2021
  6. justinmc commented on Oct 26, 2021

    @justinmc
    ContributorAuthor

    Could be, I should try the exact example with "w"s in #91861 on Windows. Though I'd expect the decorational space problem to happen in between "ni" and "hao", but it seems to happen at the "n" here.

  7. gspencergoog commented on Oct 27, 2021

    @gspencergoog
    Contributor

    When I enter just "ni" and then try to delete it, it takes three deletes to remove it, so it doesn't have to do with the extra ' character.

  8. gspencergoog commented on Oct 27, 2021

    @gspencergoog
    Contributor

    It seems like it has to do with dismissing the IME: One of the deletes dismisses the IME without removing a character.

  9. gspencergoog commented on Oct 29, 2021

    @gspencergoog
    Contributor

    OK, I think I figured it out. It appears to be because when the last character is deleted from the composing string, we fetch the composing string's std::optional<std::u16string>, and we do something if the optional is set, but we don't update the composing region if it is empty.

    The bug is here: https://github.com/flutter/engine/blob/fd992c6a0f4cc5c5b6efc4b6b60e661f3dc62916/shell/platform/windows/window_win32.cc#L195-L197

  10. gspencergoog commented on Oct 29, 2021

    @gspencergoog
    Contributor

    PR incoming.

  11. github-actions commented on Nov 15, 2021

    @github-actions

    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.

  12. locked as resolved and limited conversation to collaborators on Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: annoyanceRepeatedly frustrating issues with non-experimental functionalitya: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowplatform-windowsBuilding on or for Windows specifically

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions