app,io/router: expand IME snippets if a new range overlaps the old

Instead of cmpletely replacing the IME snippet for every update, expand
the old range if there is overlap. This change avoids never-ending
restarts of the IME on Android where snippets are expanded in two
calls, one for expanding before the selection and one for exanding after
the selection.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-04-23 13:20:46 +02:00
parent f3265e56b9
commit 0273203743
3 changed files with 49 additions and 2 deletions
-1
View File
@@ -492,7 +492,6 @@ func (c *callbacks) EditorInsert(text string) {
func (c *callbacks) EditorReplace(r key.Range, text string) {
c.w.imeState.Replace(r, text)
c.Event(key.EditEvent{Range: r, Text: text})
c.Event(key.SnippetEvent(c.w.imeState.Snippet.Range))
}
func (c *callbacks) SetEditorSelection(r key.Range) {