file_finder: Display duplicated file in file finder history (#41917)
Closes #41850 When digging into this I figured out that basically what was going on is in the history of the file finder it doesn't update the name of the file duplicated because when you duplicate a file it's named automatically with `filename copy` and so this filename was added to the history but not updated so once you wanted to go back into this file it was not part of file finder displayed history anymore because this file doesn't exist anymore but the entity id remains the same. I was also to reproduce this bug when just renaming a file. Release Notes: - Fixed: Display duplicated file in file finder history --------- Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com> Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Lukas Wirth <me@lukaswirth.dev>
This commit is contained in:
co-authored by
Conrad Irwin
Lukas Wirth
parent
58cec41932
commit
2b6cf31ace
@@ -1123,7 +1123,6 @@ impl Pane {
|
||||
false
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(existing_item_index) = existing_item_index {
|
||||
// If the item already exists, move it to the desired destination and activate it
|
||||
|
||||
@@ -4132,6 +4131,20 @@ impl NavHistory {
|
||||
.retain(|entry| entry.item.id() != item_id);
|
||||
}
|
||||
|
||||
pub fn rename_item(
|
||||
&mut self,
|
||||
item_id: EntityId,
|
||||
project_path: ProjectPath,
|
||||
abs_path: Option<PathBuf>,
|
||||
) {
|
||||
let mut state = self.0.lock();
|
||||
let path_for_item = state.paths_by_item.get_mut(&item_id);
|
||||
if let Some(path_for_item) = path_for_item {
|
||||
path_for_item.0 = project_path;
|
||||
path_for_item.1 = abs_path;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn path_for_item(&self, item_id: EntityId) -> Option<(ProjectPath, Option<PathBuf>)> {
|
||||
self.0.lock().paths_by_item.get(&item_id).cloned()
|
||||
}
|
||||
|
||||
@@ -4325,6 +4325,10 @@ impl Workspace {
|
||||
cx.emit(Event::PaneRemoved);
|
||||
}
|
||||
|
||||
pub fn panes_mut(&mut self) -> &mut [Entity<Pane>] {
|
||||
&mut self.panes
|
||||
}
|
||||
|
||||
pub fn panes(&self) -> &[Entity<Pane>] {
|
||||
&self.panes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user