Skip to content

Commit

Permalink
Fixed issue where selection in file tree disappears on move
Browse files Browse the repository at this point in the history
  • Loading branch information
curlpipe committed Dec 16, 2024
1 parent 86aa29b commit 405a712
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/editor/filetree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,9 @@ impl Editor {
if let Some(old_file) = &self.file_tree_selection.clone() {
let path = self.path_prompt()?;
if file_or_dir(old_file) == "file" {
std::fs::copy(old_file, path)?;
std::fs::copy(old_file, path.clone())?;
self.file_tree_refresh();
self.file_tree_selection = Some(path.clone());
self.feedback = Feedback::Info("File copied".to_string());
} else {
self.feedback = Feedback::Error("Not a file".to_string());
Expand All @@ -644,6 +645,7 @@ impl Editor {
let path = self.path_prompt()?;
std::fs::rename(old_file, path.clone())?;
self.file_tree_refresh();
self.file_tree_selection = Some(path.clone());
if file_or_dir(&path) == "file" {
self.feedback = Feedback::Info("File moved".to_string());
} else if file_or_dir(&path) == "directory" {
Expand Down

0 comments on commit 405a712

Please sign in to comment.