diff --git a/src/rime/gear/chord_composer.cc b/src/rime/gear/chord_composer.cc index 6ace5adf02..44323f7614 100644 --- a/src/rime/gear/chord_composer.cc +++ b/src/rime/gear/chord_composer.cc @@ -27,6 +27,8 @@ ChordComposer::ChordComposer(const Ticket& ticket) : Processor(ticket) { config->GetBool("chord_composer/use_shift", &use_shift_); config->GetBool("chord_composer/use_super", &use_super_); config->GetBool("chord_composer/use_caps", &use_caps_); + config->GetBool("chord_composer/finish_chord_on_first_key_release", + &finish_chord_on_first_key_release_); config->GetString("speller/delimiter", &delimiter_); algebra_.Load(config->GetList("chord_composer/algebra")); output_format_.Load(config->GetList("chord_composer/output_format")); @@ -104,7 +106,12 @@ ProcessResult ChordComposer::ProcessChordingKey(const KeyEvent& key_event) { editing_chord_ = true; bool is_key_up = key_event.release(); if (is_key_up) { - if (pressed_.erase(ch) != 0 && pressed_.empty()) { + if (finish_chord_on_first_key_release_) { + if (pressed_.find(ch) != pressed_.end()) { + FinishChord(); + pressed_.clear(); + } + } else if (pressed_.erase(ch) != 0 && pressed_.empty()) { FinishChord(); } } else { // key down diff --git a/src/rime/gear/chord_composer.h b/src/rime/gear/chord_composer.h index 31259edb32..2ed915a255 100644 --- a/src/rime/gear/chord_composer.h +++ b/src/rime/gear/chord_composer.h @@ -43,6 +43,7 @@ class ChordComposer : public Processor { bool use_shift_ = false; bool use_super_ = false; bool use_caps_ = false; + bool finish_chord_on_first_key_release_ = false; set pressed_; set chord_;