Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Oct 6, 2023
1 parent a3d92bf commit 98fef92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 5 additions & 5 deletions core/src/manager/finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ impl Finder {
/// Explode the name into three parts: head, body, tail.
#[inline]
pub fn highlighted(&self, name: &OsStr) -> Vec<Range<usize>> {
#[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()
}
}

Expand Down
6 changes: 0 additions & 6 deletions plugin/src/bindings/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ impl<'a, 'b> Tab<'a, 'b> {

reg.add_field_function_get("window", |_, me| me.named_user_value::<Value>("window"));
reg.add_field_function_get("files", |_, me| me.named_user_value::<AnyUserData>("files"));
reg.add_field_function_get("hovered", |_, me| me.named_user_value::<Value>("hovered"));
})?;

LUA.register_userdata_type::<core::files::Files>(|reg| {
Expand Down Expand Up @@ -158,11 +157,6 @@ impl<'a, 'b> Tab<'a, 'b> {
.collect::<Vec<_>>(),
)?;
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)
}
Expand Down

0 comments on commit 98fef92

Please sign in to comment.