Adjust key bindings based on mode, part of #547

This commit is contained in:
Jeremy Soller 2024-10-03 13:01:59 -06:00
parent a1e79c97e6
commit 8615157ec8
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
4 changed files with 58 additions and 48 deletions

View file

@ -841,6 +841,7 @@ pub enum Message {
LocationMenuAction(LocationMenuAction),
Drag(Option<Rectangle>),
EditLocation(Option<Location>),
EditLocationToggle,
OpenInNewTab(PathBuf),
EmptyTrash,
Gallery(bool),
@ -2017,6 +2018,13 @@ impl Tab {
}
self.edit_location = edit_location;
}
Message::EditLocationToggle => {
if self.edit_location.is_none() {
self.edit_location = Some(self.location.clone());
} else {
self.edit_location = None;
}
}
Message::OpenInNewTab(path) => {
commands.push(Command::OpenInNewTab(path));
}
@ -4041,9 +4049,8 @@ mod tests {
use super::{respond_to_scroll_direction, scan_path, Location, Message, Tab};
use crate::{
app::test_utils::{
assert_eq_tab_path, empty_fs, eq_path_item, filter_dirs,
read_dir_sorted, simple_fs, tab_click_new, NAME_LEN, NUM_DIRS, NUM_FILES, NUM_HIDDEN,
NUM_NESTED,
assert_eq_tab_path, empty_fs, eq_path_item, filter_dirs, read_dir_sorted, simple_fs,
tab_click_new, NAME_LEN, NUM_DIRS, NUM_FILES, NUM_HIDDEN, NUM_NESTED,
},
config::{IconSizes, TabConfig},
};