fix: backquote key will cause crash when using French IME (#892)
This commit is contained in:
parent
bc591cc1c6
commit
b888202b9b
4 changed files with 18 additions and 8 deletions
|
|
@ -12,7 +12,11 @@ Future<void> onInsert(
|
||||||
|
|
||||||
final textInserted = insertion.textInserted;
|
final textInserted = insertion.textInserted;
|
||||||
|
|
||||||
// character shortcut events
|
// In France, the backtick key is used to toggle a character style.
|
||||||
|
// We should prevent the execution of character shortcut events when the
|
||||||
|
// composing range is not collapsed.
|
||||||
|
if (insertion.composing.isCollapsed) {
|
||||||
|
// execute character shortcut events
|
||||||
final execution = await executeCharacterShortcutEvent(
|
final execution = await executeCharacterShortcutEvent(
|
||||||
editorState,
|
editorState,
|
||||||
textInserted,
|
textInserted,
|
||||||
|
|
@ -22,6 +26,7 @@ Future<void> onInsert(
|
||||||
if (execution) {
|
if (execution) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var selection = editorState.selection;
|
var selection = editorState.selection;
|
||||||
if (selection == null) {
|
if (selection == null) {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ import 'package:flutter/services.dart';
|
||||||
Future<void> onNonTextUpdate(
|
Future<void> onNonTextUpdate(
|
||||||
TextEditingDeltaNonTextUpdate nonTextUpdate,
|
TextEditingDeltaNonTextUpdate nonTextUpdate,
|
||||||
EditorState editorState,
|
EditorState editorState,
|
||||||
|
List<CharacterShortcutEvent> characterShortcutEvents,
|
||||||
) async {
|
) async {
|
||||||
|
AppFlowyEditorLog.input.debug('onNonTextUpdate: $nonTextUpdate');
|
||||||
|
|
||||||
// update the selection on Windows
|
// update the selection on Windows
|
||||||
//
|
//
|
||||||
// when typing characters with CJK IME on Windows, a non-text update is sent
|
// when typing characters with CJK IME on Windows, a non-text update is sent
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ class KeyboardServiceWidgetState extends State<KeyboardServiceWidget>
|
||||||
onNonTextUpdate: (nonTextUpdate) async => await onNonTextUpdate(
|
onNonTextUpdate: (nonTextUpdate) async => await onNonTextUpdate(
|
||||||
nonTextUpdate,
|
nonTextUpdate,
|
||||||
editorState,
|
editorState,
|
||||||
|
widget.characterShortcutEvents,
|
||||||
),
|
),
|
||||||
onPerformAction: (action) async => await onPerformAction(
|
onPerformAction: (action) async => await onPerformAction(
|
||||||
action,
|
action,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ void main() {
|
||||||
composing: TextRange(start: 0, end: 3),
|
composing: TextRange(start: 0, end: 3),
|
||||||
),
|
),
|
||||||
EditorState.blank(),
|
EditorState.blank(),
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue