From d28a7344731c4cd913687a893334555feed4e270 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Mon, 26 Dec 2016 19:00:27 -0500 Subject: Refactor bindings and fix binding tests The somewhat redundant KeyBinding and MouseBinding types were removed in favor of a Binding 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. --- src/config.rs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src/config.rs') 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 { 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 { 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) -- cgit