mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat!: Only return selected when hover is selected
With the cross-directory selection feature, it can be very unexpected to select items in a parent directory, then go into a child directory to attempt to open a file, but instead of opening the hovered file, the selected items are opened instead. This is especially obvious when using the smart-enter plugin that combines the enter and open command together. For the most part, users are most likely going to be hovering over a selected item if they want to operate on the items that they have selected, so this change will likely result in a net improvement in user experience.
This commit is contained in:
parent
457c2a5c06
commit
15b2556b56
1 changed files with 4 additions and 1 deletions
|
|
@ -51,8 +51,11 @@ impl From<&Url> for Tab {
|
|||
impl Tab {
|
||||
// --- Current
|
||||
pub fn selected_or_hovered(&self) -> Vec<&Url> {
|
||||
let hovered = self.current.hovered().map(|h| vec![&h.url]).unwrap_or_default();
|
||||
if self.selected.is_empty() {
|
||||
self.current.hovered().map(|h| vec![&h.url]).unwrap_or_default()
|
||||
hovered
|
||||
} else if !self.selected.contains(hovered[0]) {
|
||||
hovered
|
||||
} else {
|
||||
self.selected.iter().collect()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue