Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: CodeEditor IME input on Windows resets caret and inserts both Pinyin and Chinese #6211

@Qye-Leisure

Description

@Qye-Leisure

Duplicate Check

Describe the bug

Just like the screen recording I attached, only English data works fine. Once switched to Chinese data, the cursor position automatically jumps to the beginning, and it inputs both Pinyin and Chinese characters together. Python supports Chinese variables.

Code sample

Code
[import flet_code_editor as fce

import flet as ft

CODE = """# 1
# 2
# 3
import json
import textwrap

print("Folding demo")
"""


def main(page: ft.Page):
    editor = fce.CodeEditor(
        language=fce.CodeLanguage.PYTHON,
        value=CODE,
        selection=ft.TextSelection(base_offset=41, extent_offset=62),
        autofocus=True,
        
        expand=True,
        on_selection_change=lambda e: print("Selection:", e),
    )

    async def fold_imports():
        await editor.fold_imports()

    async def fold_comment():
        await editor.fold_comment_at_line_zero()

    page.add(
        ft.Row(
            [
                ft.Button("Fold imports", on_click=fold_imports),
                ft.Button("Fold comment", on_click=fold_comment),
            ]
        ),
        editor,
    )


if __name__ == "__main__":
    ft.run(main)]

To reproduce

Just like the screen recording I attached, only English data works fine. Once switched to Chinese data, the cursor position automatically jumps to the beginning, and it inputs both Pinyin and Chinese characters together. Python supports Chinese variables.

Expected behavior

No response

Screenshots / Videos

Captures
QQ2026225-171352.mp4

Operating System

Windows

Operating system details

11

Flet version

0.81.0

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions