Fix #252 on macOS.
This commit is contained in:
parent
77f902b5d5
commit
92e49b4d65
|
@ -194,6 +194,7 @@ extern fn keypress_callback(_self: *mut c_void, raw_buffer: *const u8, len: i32,
|
||||||
0x3B => Some(LEFT_CTRL),
|
0x3B => Some(LEFT_CTRL),
|
||||||
0x3E => Some(RIGHT_CTRL),
|
0x3E => Some(RIGHT_CTRL),
|
||||||
0x33 => Some(BACKSPACE),
|
0x33 => Some(BACKSPACE),
|
||||||
|
0x39 => Some(CAPS_LOCK),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,9 @@ pub enum KeyModifier {
|
||||||
RIGHT_META,
|
RIGHT_META,
|
||||||
LEFT_SHIFT,
|
LEFT_SHIFT,
|
||||||
RIGHT_SHIFT,
|
RIGHT_SHIFT,
|
||||||
|
|
||||||
|
// Special cases, should not be used in config
|
||||||
|
CAPS_LOCK,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeyModifier {
|
impl KeyModifier {
|
||||||
|
|
|
@ -21,7 +21,7 @@ use crate::matcher::{Match, MatchReceiver, TriggerEntry};
|
||||||
use std::cell::{RefCell};
|
use std::cell::{RefCell};
|
||||||
use crate::event::{KeyModifier, ActionEventReceiver, ActionType};
|
use crate::event::{KeyModifier, ActionEventReceiver, ActionType};
|
||||||
use crate::config::ConfigManager;
|
use crate::config::ConfigManager;
|
||||||
use crate::event::KeyModifier::BACKSPACE;
|
use crate::event::KeyModifier::{BACKSPACE, LEFT_SHIFT, RIGHT_SHIFT, CAPS_LOCK};
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
|
@ -237,9 +237,11 @@ impl <'a, R: MatchReceiver, M: ConfigManager<'a>> super::Matcher for ScrollingMa
|
||||||
}
|
}
|
||||||
|
|
||||||
// Consider modifiers as separators to improve word matches reliability
|
// Consider modifiers as separators to improve word matches reliability
|
||||||
|
if m != LEFT_SHIFT && m != RIGHT_SHIFT && m != CAPS_LOCK {
|
||||||
let mut was_previous_char_word_separator = self.was_previous_char_word_separator.borrow_mut();
|
let mut was_previous_char_word_separator = self.was_previous_char_word_separator.borrow_mut();
|
||||||
*was_previous_char_word_separator = true;
|
*was_previous_char_word_separator = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn handle_other(&self) {
|
fn handle_other(&self) {
|
||||||
// When receiving "other" type of events, we mark them as valid separators.
|
// When receiving "other" type of events, we mark them as valid separators.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user