aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-12-26 19:00:27 -0500
committerJoe Wilm <joe@jwilm.com>2016-12-26 19:00:27 -0500
commitd28a7344731c4cd913687a893334555feed4e270 (patch)
treef7848fc477d6a7a561769e57fa7441cced08f558 /src/config.rs
parent358c9fa17d9b088bae79f7d352a8cc21878f6303 (diff)
downloadr-alacritty-d28a7344731c4cd913687a893334555feed4e270.tar.gz
r-alacritty-d28a7344731c4cd913687a893334555feed4e270.tar.bz2
r-alacritty-d28a7344731c4cd913687a893334555feed4e270.zip
Refactor bindings and fix binding tests
The somewhat redundant KeyBinding and MouseBinding types were removed in favor of a Binding<T> type. This allows all binding code to be reused for both scenarios. The binding tests were fixed by only asserting on `is_triggered_by()` instead of checking that the action escape sequence was delivered properly.
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/config.rs b/src/config.rs
index aca16a1d..9bdcc6e6 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -383,14 +383,12 @@ struct RawBinding {
impl RawBinding {
fn into_mouse_binding(self) -> ::std::result::Result<MouseBinding, Self> {
if self.mouse.is_some() {
- Ok(MouseBinding {
- button: self.mouse.unwrap(),
- binding: Binding {
- mods: self.mods,
- action: self.action,
- mode: self.mode,
- notmode: self.notmode,
- }
+ Ok(Binding {
+ trigger: self.mouse.unwrap(),
+ mods: self.mods,
+ action: self.action,
+ mode: self.mode,
+ notmode: self.notmode,
})
} else {
Err(self)
@@ -400,13 +398,11 @@ impl RawBinding {
fn into_key_binding(self) -> ::std::result::Result<KeyBinding, Self> {
if self.key.is_some() {
Ok(KeyBinding {
- key: self.key.unwrap(),
- binding: Binding {
- mods: self.mods,
- action: self.action,
- mode: self.mode,
- notmode: self.notmode,
- }
+ trigger: self.key.unwrap(),
+ mods: self.mods,
+ action: self.action,
+ mode: self.mode,
+ notmode: self.notmode,
})
} else {
Err(self)