Skip to content

Commit

Permalink
fix backspace and navigation keys with caps lock on
Browse files Browse the repository at this point in the history
  • Loading branch information
groverlynn committed Aug 10, 2023
1 parent c515afb commit 4b870d2
Showing 1 changed file with 4 additions and 3 deletions.
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

0 comments on commit 4b870d2

Please sign in to comment.