mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
allow config fullmatch for 'which'
This commit is contained in:
parent
a0534c0900
commit
35e01d7ae9
3 changed files with 5 additions and 2 deletions
|
|
@ -189,6 +189,7 @@ sort_by = "none"
|
||||||
sort_sensitive = false
|
sort_sensitive = false
|
||||||
sort_reverse = false
|
sort_reverse = false
|
||||||
sort_translit = false
|
sort_translit = false
|
||||||
|
emit_unique = true
|
||||||
|
|
||||||
[log]
|
[log]
|
||||||
enabled = false
|
enabled = false
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ pub struct Which {
|
||||||
pub sort_sensitive: bool,
|
pub sort_sensitive: bool,
|
||||||
pub sort_reverse: bool,
|
pub sort_reverse: bool,
|
||||||
pub sort_translit: bool,
|
pub sort_translit: bool,
|
||||||
|
// emit
|
||||||
|
pub emit_unique: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for Which {
|
impl FromStr for Which {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use yazi_config::keymap::{ControlCow, Key};
|
use yazi_config::{keymap::{ControlCow, Key}, WHICH};
|
||||||
use yazi_shared::{emit, render, render_and, Layer};
|
use yazi_shared::{emit, render, render_and, Layer};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
|
|
@ -19,7 +19,7 @@ impl Which {
|
||||||
|
|
||||||
if self.cands.is_empty() {
|
if self.cands.is_empty() {
|
||||||
self.reset();
|
self.reset();
|
||||||
} else if self.cands.len() == 1 {
|
} else if self.cands.len() == 1 && WHICH.emit_unique {
|
||||||
emit!(Seq(self.cands.remove(0).into_seq(), self.layer));
|
emit!(Seq(self.cands.remove(0).into_seq(), self.layer));
|
||||||
self.reset();
|
self.reset();
|
||||||
} else if let Some(i) = self.cands.iter().position(|c| c.on.len() == self.times) {
|
} else if let Some(i) = self.cands.iter().position(|c| c.on.len() == self.times) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue