app,widget,io: implement IME positioning

This change implements reporting of the caret position from Editor, as well
as Windows, macOS, Android support. As a result, the IME composition window
on Windows and macOS is now positioned correctly.

References: https://todo.sr.ht/~eliasnaur/gio/246
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-02-13 16:28:30 +01:00
parent cffa748c6a
commit 31f55232bf
13 changed files with 295 additions and 100 deletions
+2 -2
View File
@@ -474,7 +474,7 @@ func (c *callbacks) SetComposingRegion(r key.Range) {
}
func (c *callbacks) EditorInsert(text string) {
sel := c.w.imeState.Selection
sel := c.w.imeState.Selection.Range
c.EditorReplace(sel, text)
start := sel.Start
if sel.End < start {
@@ -492,7 +492,7 @@ func (c *callbacks) EditorReplace(r key.Range, text string) {
}
func (c *callbacks) SetEditorSelection(r key.Range) {
c.w.imeState.Selection = r
c.w.imeState.Selection.Range = r
c.Event(key.SelectionEvent(r))
}