Fix #252 on macOS.

This commit is contained in:
Federico Terzi 2020-05-02 14:31:28 +02:00
parent 77f902b5d5
commit 92e49b4d65
3 changed files with 9 additions and 3 deletions

View File

@ -194,6 +194,7 @@ extern fn keypress_callback(_self: *mut c_void, raw_buffer: *const u8, len: i32,
0x3B => Some(LEFT_CTRL),
0x3E => Some(RIGHT_CTRL),
0x33 => Some(BACKSPACE),
0x39 => Some(CAPS_LOCK),
_ => None,
};

View File

@ -79,6 +79,9 @@ pub enum KeyModifier {
RIGHT_META,
LEFT_SHIFT,
RIGHT_SHIFT,
// Special cases, should not be used in config
CAPS_LOCK,
}
impl KeyModifier {

View File

@ -21,7 +21,7 @@ use crate::matcher::{Match, MatchReceiver, TriggerEntry};
use std::cell::{RefCell};
use crate::event::{KeyModifier, ActionEventReceiver, ActionType};
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::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
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();
*was_previous_char_word_separator = true;
}
}
fn handle_other(&self) {
// When receiving "other" type of events, we mark them as valid separators.