summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2022-10-03 16:12:34 +0200
committerqkzk <qu3nt1n@gmail.com>2022-10-03 16:12:34 +0200
commitfd20efac3af372d6f8bd6dfd93acedd859e2b974 (patch)
tree31d732d16dd0eba2dcf168f3e0a17038fa35f28a
parent5c4c76263ed7654e315dced7cb6ed1c8d260bbf8 (diff)
remove oldpath attribute in status. Useless
-rw-r--r--src/status.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/status.rs b/src/status.rs
index d0efbef9..92f9aa9f 100644
--- a/src/status.rs
+++ b/src/status.rs
@@ -30,8 +30,6 @@ pub struct Status {
pub file_index: usize,
/// The indexes of displayed file
pub window: FilesWindow,
- /// oldpath before renaming
- oldpath: path::PathBuf,
/// Files marked as flagged
pub flagged: HashSet<path::PathBuf>,
/// String typed by the user in relevant modes
@@ -68,7 +66,6 @@ impl Status {
let mode = Mode::Normal;
let file_index = 0;
let window = FilesWindow::new(path_content.files.len(), height);
- let oldpath = path::PathBuf::new();
let flagged = HashSet::new();
let input = Input::default();
let jump_index = 0;
@@ -79,7 +76,6 @@ impl Status {
mode,
file_index,
window,
- oldpath,
flagged,
input,
path_content,
@@ -345,11 +341,6 @@ impl Status {
pub fn event_rename(&mut self) {
self.mode = Mode::Rename;
- let oldname = self.path_content.files[self.path_content.selected]
- .filename
- .clone();
- self.oldpath = self.path_content.path.to_path_buf();
- self.oldpath.push(oldname);
}
pub fn event_chmod(&mut self) {
@@ -461,7 +452,9 @@ impl Status {
pub fn exec_rename(&mut self) {
fs::rename(
- self.oldpath.clone(),
+ self.path_content.files[self.path_content.selected]
+ .clone()
+ .path,
self.path_content
.path
.to_path_buf()