summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2019-04-19 18:01:36 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2019-04-19 18:01:36 -0400
commit393bb3efc842fb2961a8a487ef8f4c2f75167da9 (patch)
treea1e9c840bf933237f4caa0daf76a732a88a3c036
parent0b699e3f344c66568d3e1741349ff6e549198872 (diff)
remove redundant methods in struct.rs
-rw-r--r--src/structs.rs19
-rw-r--r--src/tab.rs2
2 files changed, 4 insertions, 17 deletions
diff --git a/src/structs.rs b/src/structs.rs
index fb5bd8f..0f5d0a4 100644
--- a/src/structs.rs
+++ b/src/structs.rs
@@ -171,10 +171,10 @@ impl JoshutoDirList {
pub fn get_selected_paths(&self) -> Option<Vec<PathBuf>> {
let vec: Vec<PathBuf> = self.selected_entries().map(|e| e.path.clone()).collect();
- if !vec.is_empty() {
- Some(vec)
- } else {
+ if vec.is_empty() {
Some(vec![self.get_curr_ref()?.path.clone()])
+ } else {
+ Some(vec)
}
}
@@ -201,17 +201,4 @@ impl JoshutoDirList {
None
}
}
-
- pub fn curr_toggle_select(&mut self) {
- if let Some(index) = self.index {
- self.toggle_select(index);
- }
- }
-
- fn toggle_select(&mut self, index: usize) {
- if index < self.contents.len() {
- let tmp_bool = !self.contents[index].selected;
- self.contents[index].selected = tmp_bool;
- }
- }
}
diff --git a/src/tab.rs b/src/tab.rs
index d5a63cc..a851b86 100644
--- a/src/tab.rs
+++ b/src/tab.rs
@@ -117,7 +117,7 @@ impl JoshutoTab {
ncurses::waddstr(win.win, " ");
ui::wprint_file_info(win.win, entry);
}
- ncurses::wnoutrefresh(win.win);
+ win.queue_for_refresh();
}
}