Skip to content

Commit f3a2ad0

Browse files
committed
feat(chord_composer): use Control, Alt, Shift to input chord
when enabled by options `chord_composer/use_control: true` etc.
1 parent c498f71 commit f3a2ad0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/rime/gear/chord_composer.cc

+7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ ChordComposer::ChordComposer(const Ticket& ticket) : Processor(ticket) {
2525
string alphabet;
2626
config->GetString("chord_composer/alphabet", &alphabet);
2727
chording_keys_.Parse(alphabet);
28+
config->GetBool("chord_composer/use_control", &use_control_);
29+
config->GetBool("chord_composer/use_alt", &use_alt_);
30+
config->GetBool("chord_composer/use_shift", &use_shift_);
2831
config->GetString("speller/delimiter", &delimiter_);
2932
algebra_.Load(config->GetList("chord_composer/algebra"));
3033
output_format_.Load(config->GetList("chord_composer/output_format"));
@@ -84,6 +87,10 @@ inline static int get_base_layer_key_code(const KeyEvent& key_event) {
8487
ProcessResult ChordComposer::ProcessChordingKey(const KeyEvent& key_event) {
8588
if (key_event.ctrl() || key_event.alt()) {
8689
raw_sequence_.clear();
90+
}
91+
if (key_event.ctrl() && !use_control_ ||
92+
key_event.alt() && !use_alt_ ||
93+
key_event.shift() && !use_shift_) {
8794
ClearChord();
8895
return kNoop;
8996
}

src/rime/gear/chord_composer.h

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ class ChordComposer : public Processor {
3838
Projection algebra_;
3939
Projection output_format_;
4040
Projection prompt_format_;
41+
bool use_control_ = false;
42+
bool use_alt_ = false;
43+
bool use_shift_ = false;
4144

4245
set<int> pressed_;
4346
set<int> chord_;

0 commit comments

Comments
 (0)