From 591bfc9567c8d8ce9887f1958de67abd75b7cf35 Mon Sep 17 00:00:00 2001 From: hezhengyi Date: Tue, 21 Jan 2025 11:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9uitest=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=97=B6=E5=A4=9A?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E5=AD=97=E7=AC=A6v=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hezhengyi --- .../src/main/ets/embedding/ohos/KeyEventHandler.ets | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/KeyEventHandler.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/KeyEventHandler.ets index 5fd76b3d62..e90eafc1f4 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/KeyEventHandler.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/KeyEventHandler.ets @@ -162,8 +162,14 @@ export class KeyEventHandler { if (event.type == KeyType.Down) { if (!this.isCombinationKey) { this.isCombinationKey = COMBINATION_KEYS.findIndex((it) => it == event.keyCode) >= 0; + if (this.isCombinationKey) { + this.inputMap.clear(); + } + } + if (!this.isCombinationKey) { + // Ctrl/Alt 键按下的状态,不输入字符(字母/数字/符号) + this.inputMap.set(event.keyCode, text); } - this.inputMap.set(event.keyCode, text); } else if (event.type == KeyType.Up) { if (COMBINATION_KEYS.findIndex((it) => it == event.keyCode) >= 0) { // Ctrl/Alt 键抬起,重置状态 -- Gitee