diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c54faccb2..0eafd0e5e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -100,6 +100,7 @@ Bruce Harris Patric Cunha Brayan Oliveira Luka Warren +wisherhxl ******************** diff --git a/ts/editor/rich-text-input/RichTextInput.svelte b/ts/editor/rich-text-input/RichTextInput.svelte index 2eabbd29a..7409c3319 100644 --- a/ts/editor/rich-text-input/RichTextInput.svelte +++ b/ts/editor/rich-text-input/RichTextInput.svelte @@ -72,6 +72,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html async function moveCaretToEnd(): Promise { const richText = await richTextPromise; + if (richText.textContent?.length === 0) { + // Calling this method when richText is empty will cause the first keystroke of + // ibus-based input methods with candidates to go double. For example, if you + // type "a" it becomes "aa". This problem exists in many linux distributions. + // When richText is empty, there is no need to place the caret, just return. + return; + } + placeCaretAfterContent(richText); }