Description: If a line in Writer ends with whitespace it seems that if the IME calls the delete surrounding text API the whitespace is not counted and the character before the whitespace instead of the whitespace deleted. Things work correctly if there are non-whitespace characters following. Steps to Reproduce: 1. On a recent Ubuntu installation (24.04), running Gnome Shell, install the `keyman` package (https://keyman.com) 2. Download and unpack the keyboard from https://github.com/user-attachments/files/19472018/lowhitespacebug.zip. 3. Run `km-config` and install the unpacked keyboard 4. Open Writer, switch to the lowhitespacebug keyboard and type `ab `, then type `>` (Shift+.) Actual Results: The `b` gets replaced with `→`, followed by a space, making the line `a→ `. Expected Results: Expected is that the space gets replaced by `→`, resulting in the line `ab→`. Reproducible: Always User Profile Reset: No Additional Info: I tested this with LO 7.3.7.2 and 24.2.7.2, ibus 1.5.29-2, keyman 17.0.295-1. It's working correctly in other apps, and Keyman outputs the same data in other apps as with Writer, so I don't think this is caused by Keyman. Similar wrong behavior can be seen by just pressing backspace key after trailing whitespace (backspace also causes delete surrounding text to be called). Note that you won't see the behavior if you move your cursor around because that causes a loss of context, so Keyman doesn't try to delete the previous character if you press `>`. See also https://github.com/keymanapp/keyman/issues/13522. Version: 24.2.7.2 (X86_64) / LibreOffice Community Build ID: 420(Build:2) CPU threads: 4; OS: Linux 6.11; UI render: default; VCL: gtk3 Locale: en-US (en_US.UTF-8); UI: en-US Ubuntu package version: 4:24.2.7-0ubuntu0.24.04.3 Calc: threaded