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", "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" }, { on = [ "c", "n" ], exec = "copy name_without_ext", desc = "Copy the name of the file without the extension" },
# Filter
{ on = [ "f" ], exec = "filter" },
# Find # Find
{ on = [ "/" ], exec = "find --smart" }, { on = [ "/" ], exec = "find --smart" },
{ on = [ "?" ], exec = "find --previous --smart" }, { on = [ "?" ], exec = "find --previous --smart" },
{ on = [ "n" ], exec = "find_arrow" }, { on = [ "n" ], exec = "find_arrow" },
{ on = [ "N" ], exec = "find_arrow --previous" }, { on = [ "N" ], exec = "find_arrow --previous" },
# Filter
{ on = [ "f" ], exec = "filter" },
# Sorting # Sorting
{ on = [ ",", "m" ], exec = "sort modified --dir_first", desc = "Sort by modified time" }, { 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)" }, { 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_origin = "top-center"
delete_offset = [ 0, 2, 50, 3 ] delete_offset = [ 0, 2, 50, 3 ]
# filter
filter_title = "Filter:"
filter_origin = "top-center"
filter_offset = [ 0, 2, 50, 3 ]
# find # find
find_title = [ "Find next:", "Find previous:" ] find_title = [ "Find next:", "Find previous:" ]
find_origin = "top-center" find_origin = "top-center"
@ -149,11 +154,6 @@ search_title = "Search:"
search_origin = "top-center" search_origin = "top-center"
search_offset = [ 0, 2, 50, 3 ] search_offset = [ 0, 2, 50, 3 ]
# filter
filter_title = "Filter:"
filter_origin = "top-center"
filter_offset = [ 0, 2, 50, 3 ]
# shell # shell
shell_title = [ "Shell:", "Shell (block):" ] shell_title = [ "Shell:", "Shell (block):" ]
shell_origin = "top-center" shell_origin = "top-center"

View file

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

View file

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

View file

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