Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
dev
-
None
-
Debian testing ("bookworm"), Qtbase self-compiled from dev branch as of commit 59f8da17e6a2989b072254970d23281301114503
-
-
c7b925757 (dev), 1cdc19766 (6.6), 23b05211c (6.5)
Description
When retrieving the character at the current cursor/caret position using the GetCharAtOffset method from the AT-SPI Text interface, the character is not correctly reported when its UTF-16 representation has 2 surrogate pairs, i.e. it has a Unicode code point above 65535.
Sample steps to reproduce:
1) build the attached sample program "qt-sample-app-character":
cmake . make
2) run the app, which has a QTextEdit with the text "abc𐐷d" and moves the cursor to before the "𐐷" (U+10437) character
3) run the attached Python/pyatspi script that retrieves the character at the cursor position using the GetCharAtOffset method from the AT-SPI text interface tha the QTextEdit provides on Linux.
Actual result:
An incorrect code point is reported:
$ python3 pyatspi-script-print-char-at-cursor.py code point of char at cursor: 0xfffffff0 Traceback (most recent call last): File "/home/michi/git/computer-doc/TODO/misc/pyatspi-script-print-char-at-cursor.py", line 42, in <module> print('char at cursor: {}'.format(chr(char_at_cursor))) ^^^^^^^^^^^^^^^^^^^ OverflowError: Python int too large to convert to C int
Expected result:
The script should print the unicode codepoint of the "𐐷" character in hex ("0x10437") and the original character:
$ python3 pyatspi-script-print-char-at-cursor.py code point of char at cursor: 0x10437 char at cursor: 𐐷
Note: There's a similar/related Gerrit change for LibreOffice:
https://gerrit.libreoffice.org/c/core/+/151303