Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: chord_composer should stop at super and caps by default #808

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/rime/gear/chord_composer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ChordComposer::ChordComposer(const Ticket& ticket) : Processor(ticket) {
config->GetBool("chord_composer/use_control", &use_control_);
config->GetBool("chord_composer/use_alt", &use_alt_);
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->GetString("speller/delimiter", &delimiter_);
algebra_.Load(config->GetList("chord_composer/algebra"));
output_format_.Load(config->GetList("chord_composer/output_format"));
Expand Down Expand Up @@ -81,11 +83,13 @@ inline static int get_base_layer_key_code(const KeyEvent& key_event) {
}

ProcessResult ChordComposer::ProcessChordingKey(const KeyEvent& key_event) {
if (key_event.ctrl() || key_event.alt()) {
if (key_event.ctrl() || key_event.alt() || key_event.super() ||
key_event.caps()) {
raw_sequence_.clear();
}
if ((key_event.ctrl() && !use_control_) || (key_event.alt() && !use_alt_) ||
(key_event.shift() && !use_shift_)) {
(key_event.shift() && !use_shift_) ||
(key_event.super() && !use_super_) || (key_event.caps() && !use_caps_)) {
ClearChord();
return kNoop;
}
Expand Down
2 changes: 2 additions & 0 deletions src/rime/gear/chord_composer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class ChordComposer : public Processor {
bool use_control_ = false;
bool use_alt_ = false;
bool use_shift_ = false;
bool use_super_ = false;
bool use_caps_ = false;

set<int> pressed_;
set<int> chord_;
Expand Down
Loading