allow config fullmatch for 'which'

This commit is contained in:
fwt 2024-07-13 19:58:34 +08:00
parent a0534c0900
commit 35e01d7ae9
3 changed files with 5 additions and 2 deletions

View file

@ -189,6 +189,7 @@ sort_by = "none"
sort_sensitive = false
sort_reverse = false
sort_translit = false
emit_unique = true
[log]
enabled = false

View file

@ -12,6 +12,8 @@ pub struct Which {
pub sort_sensitive: bool,
pub sort_reverse: bool,
pub sort_translit: bool,
// emit
pub emit_unique: bool,
}
impl FromStr for Which {

View file

@ -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};
#[derive(Default)]
@ -19,7 +19,7 @@ impl Which {
if self.cands.is_empty() {
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));
self.reset();
} else if let Some(i) = self.cands.iter().position(|c| c.on.len() == self.times) {