diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-04-19 14:24:59 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-04-19 14:25:04 -0400 |
commit | 0b699e3f344c66568d3e1741349ff6e549198872 (patch) | |
tree | 1f87dcaf745df548b5c45cc7ce3133df85b1c557 /src/commands/rename_file.rs | |
parent | 5e06059c4b6976ee834097a6cbc2017e21fcb410 (diff) |
add more functionality for file_operations
- renaming a file now looks for it after
Diffstat (limited to 'src/commands/rename_file.rs')
-rw-r--r-- | src/commands/rename_file.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/commands/rename_file.rs b/src/commands/rename_file.rs index 05ec9ae..844b7f0 100644 --- a/src/commands/rename_file.rs +++ b/src/commands/rename_file.rs @@ -1,7 +1,7 @@ use std::fs; use std::path; -use crate::commands::{JoshutoCommand, JoshutoRunnable}; +use crate::commands::{CursorMove, JoshutoCommand, JoshutoRunnable, Search}; use crate::context::JoshutoContext; use crate::error::JoshutoError; use crate::preview; @@ -116,7 +116,10 @@ impl JoshutoRunnable for RenameFile { if let Some(file_name) = file_name { if let Some(path) = path { - let res = self.rename_file(&path, context, view, file_name); + let res = self.rename_file(&path, context, view, file_name.clone()); + if let Some(index) = Search::search(context.curr_tab_ref(), &file_name) { + CursorMove::cursor_move(index, context, view); + } preview::preview_file( &mut context.tabs[context.curr_tab_index], view, |