mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix linux build break
This commit is contained in:
parent
b0d18e86fc
commit
c85bbe7fe4
2 changed files with 7 additions and 8 deletions
|
|
@ -72,9 +72,9 @@ impl<'a> Folder<'a> {
|
||||||
let v = self.is_find.then_some(()).and_then(|_| {
|
let v = self.is_find.then_some(()).and_then(|_| {
|
||||||
let finder = self.cx.manager.active().finder()?;
|
let finder = self.cx.manager.active().finder()?;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let (head, body, tail) = finder.explode(&short.name.to_string_lossy())?;
|
let (head, body, tail) = finder.explode(short.name.to_string_lossy().as_bytes())?;
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
let (head, body, tail) = finder.explode(&short.name)?;
|
let (head, body, tail) = finder.explode(short.name.as_bytes())?;
|
||||||
|
|
||||||
// TODO: to be configured by THEME?
|
// TODO: to be configured by THEME?
|
||||||
let style = Style::new().fg(Color::Rgb(255, 255, 50)).add_modifier(Modifier::ITALIC);
|
let style = Style::new().fg(Color::Rgb(255, 255, 50)).add_modifier(Modifier::ITALIC);
|
||||||
|
|
|
||||||
|
|
@ -111,13 +111,12 @@ impl Finder {
|
||||||
|
|
||||||
/// Explode the name into three parts: head, body, tail.
|
/// Explode the name into three parts: head, body, tail.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn explode<'a>(&self, name: &'a impl AsRef<str>) -> Option<(String, String, String)> {
|
pub fn explode<'a>(&self, name: &[u8]) -> Option<(String, String, String)> {
|
||||||
let b = name.as_ref().as_bytes();
|
let range = self.query.find(name).map(|m| m.range())?;
|
||||||
let range = self.query.find(b).map(|m| m.range())?;
|
|
||||||
Some((
|
Some((
|
||||||
String::from_utf8_lossy(&b[..range.start]).to_string(),
|
String::from_utf8_lossy(&name[..range.start]).to_string(),
|
||||||
String::from_utf8_lossy(&b[range.start..range.end]).to_string(),
|
String::from_utf8_lossy(&name[range.start..range.end]).to_string(),
|
||||||
String::from_utf8_lossy(&b[range.end..]).to_string(),
|
String::from_utf8_lossy(&name[range.end..]).to_string(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue