This commit is contained in:
sxyazi 2023-12-24 23:05:51 +08:00
parent 9873559642
commit 3acadaec1a
No known key found for this signature in database
5 changed files with 21 additions and 23 deletions

View file

@ -89,15 +89,15 @@ keymap = [
{ on = [ "c", "f" ], exec = "copy filename", desc = "Copy the name of the file" },
{ on = [ "c", "n" ], exec = "copy name_without_ext", desc = "Copy the name of the file without the extension" },
# Filter
{ on = [ "f" ], exec = "filter" },
# Find
{ on = [ "/" ], exec = "find --smart" },
{ on = [ "?" ], exec = "find --previous --smart" },
{ on = [ "n" ], exec = "find_arrow" },
{ on = [ "N" ], exec = "find_arrow --previous" },
# Filter
{ on = [ "f" ], exec = "filter" },
# Sorting
{ on = [ ",", "m" ], exec = "sort modified --dir_first", desc = "Sort by modified time" },
{ on = [ ",", "M" ], exec = "sort modified --reverse --dir_first", desc = "Sort by modified time (reverse)" },

View file

@ -139,6 +139,11 @@ delete_title = "Delete {n} selected file{s} permanently? (y/N)"
delete_origin = "top-center"
delete_offset = [ 0, 2, 50, 3 ]
# filter
filter_title = "Filter:"
filter_origin = "top-center"
filter_offset = [ 0, 2, 50, 3 ]
# find
find_title = [ "Find next:", "Find previous:" ]
find_origin = "top-center"
@ -149,11 +154,6 @@ search_title = "Search:"
search_origin = "top-center"
search_offset = [ 0, 2, 50, 3 ]
# filter
filter_title = "Filter:"
filter_origin = "top-center"
filter_offset = [ 0, 2, 50, 3 ]
# shell
shell_title = [ "Shell:", "Shell (block):" ]
shell_origin = "top-center"

View file

@ -30,16 +30,16 @@ pub struct Input {
pub delete_origin: Origin,
pub delete_offset: Offset,
// filter
pub filter_title: String,
pub filter_origin: Origin,
pub filter_offset: Offset,
// find
pub find_title: [String; 2],
pub find_origin: Origin,
pub find_offset: Offset,
// filter
pub filter_title: String,
pub filter_origin: Origin,
pub filter_offset: Offset,
// search
pub search_title: String,
pub search_origin: Origin,

View file

@ -68,20 +68,20 @@ impl InputCfg {
}
#[inline]
pub fn find(prev: bool) -> Self {
pub fn filter() -> Self {
Self {
title: INPUT.find_title[prev as usize].to_owned(),
position: Position::new(INPUT.find_origin, INPUT.find_offset),
title: INPUT.filter_title.to_owned(),
position: Position::new(INPUT.filter_origin, INPUT.filter_offset),
realtime: true,
..Default::default()
}
}
#[inline]
pub fn filter() -> Self {
pub fn find(prev: bool) -> Self {
Self {
title: INPUT.filter_title.to_owned(),
position: Position::new(INPUT.filter_origin, INPUT.filter_offset),
title: INPUT.find_title[prev as usize].to_owned(),
position: Position::new(INPUT.find_origin, INPUT.find_offset),
realtime: true,
..Default::default()
}

View file

@ -12,9 +12,7 @@ pub struct Opt<'a> {
}
impl<'a> From<&'a Exec> for Opt<'a> {
fn from(e: &'a Exec) -> Self {
Self { query: e.args.first().map(|s| s.as_str()) }
}
fn from(e: &'a Exec) -> Self { Self { query: e.args.first().map(|s| s.as_str()) } }
}
impl Tab {
@ -50,7 +48,7 @@ impl Tab {
(None, Some(first)) => {
self.current.hover(&first.url());
}
(_, _) => {}
(..) => {}
}
}