Here is a patch adding support for answering queries from GTK input methods to retrieve or alter the text surrounding the caret. This is a feature used by more sophisticated input methods either to improve their context awareness (e.g. not allowing inputting invalid character sequences in languages with such restrictions, adjusting case depending on punctuation before the cursor, etc.) or improving context integration (e.g. when input should lead to combination, adjusting spacing, etc.).
Attached patch implements both for the GTK platform. Tested mainly with GTK 3.24.
To test, you could use a real input method that uses these features, or play with my toy for testing https://github.com/b4n/ibus-caesar (beware, it's annoying to type like that -- you can comment-out the ciphering of characters as you type, less annoying).
Committed as [2cdc4e].
Related
Commit: [2cdc4e]
surrounding code serialized.
To do :
Committed as [2cc4d2].
Related
Commit: [2cc4d2]
We can handle preedit string in line as it is.
Surrounding deleted should be blocked from reviving.
bug : surrounding deleted revives
https://youtu.be/H_XtMgslYcM
solve : tentativeUndo in advance
https://youtu.be/rlXIKl4CW7g
Last edit: johnsonj 2025-05-06
Committed as [24d898].
Related
Commit: [24d898]