mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: hover(Some) should track the location of the file regardless
This commit is contained in:
parent
085f7e39bf
commit
59f79a2ae5
3 changed files with 13 additions and 8 deletions
|
|
@ -25,9 +25,15 @@ impl Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hover(&mut self, opt: impl Into<Opt>) {
|
pub fn hover(&mut self, opt: impl Into<Opt>) {
|
||||||
// Hover on the file
|
|
||||||
let opt = opt.into() as Opt;
|
let opt = opt.into() as Opt;
|
||||||
render!(self.current_mut().repos(opt.url));
|
|
||||||
|
// Hover on the file
|
||||||
|
render!(self.current_mut().repos(opt.url.as_ref()));
|
||||||
|
if opt.url.zip(self.current().hovered()).is_some_and(|(u, f)| u == f.url) {
|
||||||
|
// `hover(Some)` occurs after user actions, such as create, rename, reveal, etc.
|
||||||
|
// At this point, it's intuitive to track the location of this file regardless.
|
||||||
|
self.current_mut().tracing = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Re-peek
|
// Re-peek
|
||||||
self.peek(false);
|
self.peek(false);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ function M:preload()
|
||||||
|
|
||||||
local i, j = 1, 0
|
local i, j = 1, 0
|
||||||
repeat
|
repeat
|
||||||
local next, event = child:read_line_with { timeout = 100 }
|
local next, event = child:read_line_with { timeout = 300 }
|
||||||
if event == 3 then
|
if event == 3 then
|
||||||
flush(true)
|
flush(true)
|
||||||
goto continue
|
goto continue
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,11 @@ pub struct Cha;
|
||||||
impl Cha {
|
impl Cha {
|
||||||
pub fn register(lua: &Lua) -> mlua::Result<()> {
|
pub fn register(lua: &Lua) -> mlua::Result<()> {
|
||||||
lua.register_userdata_type::<yazi_shared::fs::Cha>(|reg| {
|
lua.register_userdata_type::<yazi_shared::fs::Cha>(|reg| {
|
||||||
reg.add_field_method_get("is_link", |_, me| Ok(me.is_link()));
|
|
||||||
reg.add_field_method_get("is_hidden", |_, me| Ok(me.is_hidden()));
|
|
||||||
|
|
||||||
// Metadata
|
|
||||||
reg.add_field_method_get("is_dir", |_, me| Ok(me.is_dir()));
|
reg.add_field_method_get("is_dir", |_, me| Ok(me.is_dir()));
|
||||||
reg.add_field_method_get("is_symlink", |_, me| Ok(me.is_link()));
|
reg.add_field_method_get("is_hidden", |_, me| Ok(me.is_hidden()));
|
||||||
|
reg.add_field_method_get("is_link", |_, me| Ok(me.is_link()));
|
||||||
|
reg.add_field_method_get("is_bad_link", |_, me| Ok(me.is_bad_link()));
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
reg.add_field_method_get("is_block_device", |_, me| Ok(me.is_block_device()));
|
reg.add_field_method_get("is_block_device", |_, me| Ok(me.is_block_device()));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue