fix(editor): keep Enter and Tab with the IME during composition
This commit is contained in:
1 parent
b9ea54350d
commit
16491cc3dd
5 files changed
+216
No files matched your search
@@ -13,6 +13,8 @@ interface RetryCompletionAcceptanceOptions {
|
||||
maxWaitMs: number;
|
||||
onUnavailable: () => void;
|
||||
onSettled?: () => void;
|
||||
/** Called before each retry; when an IME composition started while waiting, the queued acceptance must be dropped instead of fighting the IME. */
|
||||
isComposing?: () => boolean;
|
||||
}
|
||||
|
||||
interface CompletionAcceptanceAttempt {
|
||||
@@ -52,6 +54,11 @@ export function acceptSelectedCompletionWithRetry(view: EditorView, options: Ret
|
||||
timer = null;
|
||||
if (settled) return;
|
||||
|
||||
if (options.isComposing?.()) {
|
||||
settle();
|
||||
return;
|
||||
}
|
||||
|
||||
const selectionRanges = view.state.selection.ranges;
|
||||
if (view.state.doc !== initialDoc || selectionRanges.length !== initialSelectionRanges.length || selectionRanges.some((range, index) => range.anchor !== initialSelectionRanges[index]?.anchor || range.head !== initialSelectionRanges[index]?.head)) {
|
||||
settle();
|
||||
|
||||
Reference in new issue
Block a user