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 backspace and navigation keys with caps lock on #687

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 4 additions & 3 deletions src/rime/key_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class KeyEvent {

int keycode() const { return keycode_; }
void keycode(int value) { keycode_ = value; }
int modifier() const { return modifier_; }
int modifier() const { return (modifier_ & ~kLockMask); }
void modifier(int value) { modifier_ = value; }

bool shift() const { return (modifier_ & kShiftMask) != 0; }
Expand All @@ -41,13 +41,14 @@ class KeyEvent {
RIME_API bool Parse(const string& repr);

bool operator==(const KeyEvent& other) const {
return keycode_ == other.keycode_ && modifier_ == other.modifier_;
return (keycode_ == other.keycode_) &&
((modifier_ & ~kLockMask) == (other.modifier_ & ~kLockMask));
}

bool operator<(const KeyEvent& other) const {
if (keycode_ != other.keycode_)
return keycode_ < other.keycode_;
return modifier_ < other.modifier_;
return (modifier_ & ~kLockMask) < (other.modifier_ & ~kLockMask);
}

private:
Expand Down