From 7bfde7b18300bc5e888886416e4e411281efdcff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=85=E6=88=8E=E6=B0=8F?= Date: Wed, 31 Jul 2024 13:23:04 +0800 Subject: [PATCH] (chord_composer): do not show blank chord prompt optimize for the scenario that space key opens preview popup in Mac finder --- src/rime/gear/chord_composer.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rime/gear/chord_composer.cc b/src/rime/gear/chord_composer.cc index 934e923bf7..e3b3a4a573 100644 --- a/src/rime/gear/chord_composer.cc +++ b/src/rime/gear/chord_composer.cc @@ -174,6 +174,11 @@ void ChordComposer::UpdateChord(const Chord& chord) { return; Context* ctx = engine_->context(); Composition& comp = ctx->composition(); + // do not show chord prompt if the chord is empty or only contains space. + if (chord.empty() || (chord.size() == 1 && chord.count(' ') > 0)) { + ClearChord(); + return; + } string code = SerializeChord(chord); prompt_format_.Apply(&code); if (comp.empty()) {