Save/simplify show hidden items (#1026)
Closes: #1022, #605 See: #982 Original PR: #36 This commit reimplements saving the "show hidden" files setting. I simplified the implementation by making the toggle global. My original PR (#36) implemented per tab show hidden, but that complicates saving configs which is why (I think?) why the saving the toggle was scrapped.
This commit is contained in:
parent
c99caff5ed
commit
ec685bd185
2 changed files with 18 additions and 17 deletions
25
src/tab.rs
25
src/tab.rs
|
|
@ -1401,7 +1401,6 @@ pub enum Message {
|
|||
SetSort(HeadingOptions, bool),
|
||||
TabComplete(PathBuf, Vec<(String, PathBuf)>),
|
||||
Thumbnail(PathBuf, ItemThumbnail),
|
||||
ToggleShowHidden,
|
||||
View(View),
|
||||
ToggleSort(HeadingOptions),
|
||||
Drop(Option<(Location, ClipboardPaste)>),
|
||||
|
|
@ -2799,15 +2798,24 @@ impl Tab {
|
|||
Message::Config(config) => {
|
||||
// View is preserved for existing tabs
|
||||
let view = self.config.view;
|
||||
let show_hidden = self.config.show_hidden;
|
||||
let military_time_changed = self.config.military_time != config.military_time;
|
||||
let show_hidden_changed = self.config.show_hidden != config.show_hidden;
|
||||
self.config = config;
|
||||
self.config.view = view;
|
||||
self.config.show_hidden = show_hidden;
|
||||
if military_time_changed {
|
||||
self.date_time_formatter = date_time_formatter(self.config.military_time);
|
||||
self.time_formatter = time_formatter(self.config.military_time);
|
||||
}
|
||||
if show_hidden_changed {
|
||||
if let Location::Search(path, term, ..) = &self.location {
|
||||
cd = Some(Location::Search(
|
||||
path.clone(),
|
||||
term.clone(),
|
||||
self.config.show_hidden,
|
||||
Instant::now(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
Message::ContextAction(action) => {
|
||||
// Close context menu
|
||||
|
|
@ -3499,17 +3507,6 @@ impl Tab {
|
|||
}
|
||||
}
|
||||
}
|
||||
Message::ToggleShowHidden => {
|
||||
self.config.show_hidden = !self.config.show_hidden;
|
||||
if let Location::Search(path, term, ..) = &self.location {
|
||||
cd = Some(Location::Search(
|
||||
path.clone(),
|
||||
term.clone(),
|
||||
self.config.show_hidden,
|
||||
Instant::now(),
|
||||
));
|
||||
}
|
||||
}
|
||||
Message::View(view) => {
|
||||
self.config.view = view;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue