From 90daf295c7dd5fedc3219b8947fac110f05cc522 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Sat, 3 Aug 2024 11:06:14 +0200 Subject: add editor keymap --- src/config/keymap/keymap_store.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/config/keymap/keymap_store.rs') diff --git a/src/config/keymap/keymap_store.rs b/src/config/keymap/keymap_store.rs index c782219..233ac52 100644 --- a/src/config/keymap/keymap_store.rs +++ b/src/config/keymap/keymap_store.rs @@ -48,17 +48,16 @@ pub trait Runnable where Self: Send, { - fn run(&self) -> Result<()>; + fn run(&self) -> Result; } impl Runnable for T where - T: Fn(), + T: Fn() -> bool, Self: Send, { - fn run(&self) -> Result<()> { - self(); - Ok(()) + fn run(&self) -> Result { + Ok(self()) } } @@ -66,11 +65,10 @@ impl Runnable for RegistryKey where Self: Send, { - fn run(&self) -> Result<()> { + fn run(&self) -> Result { let lua = lua::get(); let func: Function = lua.registry_value(self)?; - func.call::<(), ()>(())?; - Ok(()) + Ok(func.call::<(), bool>(()).unwrap_or(false)) } } -- cgit v1.2.3-70-g09d2