From 98fef922645d227dfb269e10bdf8e9eeab012ed6 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 7 Oct 2023 01:14:21 +0800 Subject: [PATCH] .. --- core/src/manager/finder.rs | 10 +++++----- plugin/src/bindings/tab.rs | 6 ------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/core/src/manager/finder.rs b/core/src/manager/finder.rs index 8a7741fe3..426ad736b 100644 --- a/core/src/manager/finder.rs +++ b/core/src/manager/finder.rs @@ -92,16 +92,16 @@ impl Finder { /// Explode the name into three parts: head, body, tail. #[inline] pub fn highlighted(&self, name: &OsStr) -> Vec> { - #[cfg(target_os = "windows")] - let found = self.query.find(name.to_string_lossy().as_bytes()); + #[cfg(windows)] + let found = self.query.find(name.to_string_lossy().as_bytes()).map(|m| m.range()); - #[cfg(not(target_os = "windows"))] + #[cfg(unix)] let found = { use std::os::unix::ffi::OsStrExt; - self.query.find(name.as_bytes()) + self.query.find(name.as_bytes()).map(|m| m.range()) }; - found.map(|m| vec![m.range()]).unwrap_or_default() + found.map(|r| vec![r]).unwrap_or_default() } } diff --git a/plugin/src/bindings/tab.rs b/plugin/src/bindings/tab.rs index 278c36482..f59d6773f 100644 --- a/plugin/src/bindings/tab.rs +++ b/plugin/src/bindings/tab.rs @@ -54,7 +54,6 @@ impl<'a, 'b> Tab<'a, 'b> { reg.add_field_function_get("window", |_, me| me.named_user_value::("window")); reg.add_field_function_get("files", |_, me| me.named_user_value::("files")); - reg.add_field_function_get("hovered", |_, me| me.named_user_value::("hovered")); })?; LUA.register_userdata_type::(|reg| { @@ -158,11 +157,6 @@ impl<'a, 'b> Tab<'a, 'b> { .collect::>(), )?; ud.set_named_user_value("files", self.files(&inner.files)?)?; - // TODO: remove this - ud.set_named_user_value( - "hovered", - inner.hovered.as_ref().and_then(|h| self.file(999, h, inner).ok()), - )?; Ok(ud) }