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

ignore certain modifiers #647

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion src/rime/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,4 @@ void Context::ClearTransientOptions() {
}
}

} // namespace rime
} // namespace rime
2 changes: 1 addition & 1 deletion src/rime/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ class Context {

} // namespace rime

#endif // RIME_CONTEXT_H_
#endif // RIME_CONTEXT_H_
2 changes: 1 addition & 1 deletion src/rime/dict/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,4 @@ class Table : public MappedFile {

} // namespace rime

#endif // RIME_TABLE_H_
#endif // RIME_TABLE_H_
7 changes: 4 additions & 3 deletions src/rime/gear/ascii_composer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ ProcessResult AsciiComposer::ProcessKeyEvent(const KeyEvent& key_event) {
if (is_shift || is_ctrl) {
if (key_event.release()) {
if (shift_key_pressed_ || ctrl_key_pressed_) {
auto now = std::chrono::steady_clock::now();
if (now < toggle_expired_) {
ToggleAsciiModeWithKey(ch);
if (!key_event.ignored()) {
auto now = std::chrono::steady_clock::now();
if (now < toggle_expired_)
ToggleAsciiModeWithKey(ch);
}
shift_key_pressed_ = ctrl_key_pressed_ = false;
return kNoop;
Expand Down
1 change: 1 addition & 0 deletions src/rime/key_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class KeyEvent {
bool alt() const { return (modifier_ & kAltMask) != 0; }
bool caps() const { return (modifier_ & kLockMask) != 0; }
bool super() const { return (modifier_ & kSuperMask) != 0; }
bool ignored() const { return (modifier_ & kIgnoredMask) != 0; }
bool release() const { return (modifier_ & kReleaseMask) != 0; }
// 按鍵表示為形如「狀態+鍵名」的文字
// 若無鍵名,則以四位或六位十六进制数形式的文字來標識
Expand Down
8 changes: 3 additions & 5 deletions test/table_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <rime/algo/syllabifier.h>
#include <rime/dict/table.h>


class RimeTableTest : public ::testing::Test {
public:
virtual void SetUp() {
Expand All @@ -23,9 +22,8 @@ class RimeTableTest : public ::testing::Test {
}
table_->Load();
}
virtual void TearDown() {
table_->Close();
}
virtual void TearDown() { table_->Close(); }

protected:
static const int total_num_entries = 8;
static const char file_name[];
Expand Down Expand Up @@ -92,7 +90,7 @@ void RimeTableTest::PrepareSampleVocabulary(rime::Syllabary& syll,
d->code.resize(3);
d->code.push_back(2);
d->code.push_back(1);
d->text = "yi-er-san-er-yi";
d->text = "yi-er-san-er-yi";
(*lv4)[-1].entries.push_back(d);
}

Expand Down