Skip to content

In IME mode, event.start property is wrong in TEXTEDITING event in several conditions #3755

@sunjunzero

Description

@sunjunzero

Pygame-CE version: 2.5.7
When input in IME mode, event.start will be wrongly set to len(event.text) in follow cases:

  1. delete the first char in IME mode
    a)press same char in IME mode
    b)press left, let the start is 1
    c)press backspace to delete first char
    expected: new TEXTEDITING event with start 0 or -1
    actual: new TEXTEDITING event with len(text)
  2. when the start is 1, press left
    a)press same char in IME mode
    b)press left, let the start is 1
    c)press left again
    expected: new TEXTEDITING event with start 0 or -1
    actual: new TEXTEDITING event with len(text)

Workarounds:
for case 1, the text in new event is shorter than previous event, so we can detect this case
for case 2, when text is more than 2 chars, when event.start switch from 1 to len(text), we can detect; but it there is only 2 chars typed in IME mode, we cannot detect it is pressing left or right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions