summaryrefslogtreecommitdiffstats
path: root/src/git_interactive.rs
diff options
context:
space:
mode:
authorTim Oram <dev@mitmaro.ca>2020-10-29 09:37:29 -0230
committerTim Oram <dev@mitmaro.ca>2020-10-29 21:11:53 -0230
commit4cd7109b36d200b252c36dd29b23eb5c26a03989 (patch)
tree59c29f0e4ca7da7647a1b9a9f1adea8f2c7f15a3 /src/git_interactive.rs
parent02ad2569f3b0c2608b873af132e7ba89a9a9837e (diff)
Move visual start index to list module
The visual start index is only used in the List module and should not exist in the GitInteractive struct. This change moves the visual start index into the List module and updates any references to it.
Diffstat (limited to 'src/git_interactive.rs')
-rw-r--r--src/git_interactive.rs23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/git_interactive.rs b/src/git_interactive.rs
index d440fe0..f0d64c6 100644
--- a/src/git_interactive.rs
+++ b/src/git_interactive.rs
@@ -9,7 +9,6 @@ pub struct GitInteractive {
filepath: String,
lines: Vec<Line>,
selected_line_index: usize,
- visual_index_start: Option<usize>,
comment_char: String,
is_noop: bool,
}
@@ -21,7 +20,6 @@ impl GitInteractive {
lines: vec![],
selected_line_index: 1,
is_noop: false,
- visual_index_start: None,
comment_char: String::from(comment_char),
}
}
@@ -75,18 +73,6 @@ impl GitInteractive {
self.selected_line_index = selected_line_index;
}
- pub(crate) fn set_visual_index(&mut self, visual_index: usize) {
- self.visual_index_start = Some(visual_index);
- }
-
- pub(crate) fn start_visual_mode(&mut self) {
- self.visual_index_start = Some(self.selected_line_index);
- }
-
- pub(crate) fn end_visual_mode(&mut self) {
- self.visual_index_start = None;
- }
-
pub(crate) fn swap_lines(&mut self, a: usize, b: usize) {
self.lines.swap(a, b);
}
@@ -95,10 +81,7 @@ impl GitInteractive {
self.lines[self.selected_line_index - 1].edit_content(content);
}
- pub(crate) fn set_range_action(&mut self, action: Action) {
- let end_index = self.visual_index_start.unwrap_or(self.selected_line_index);
- let start_index = self.selected_line_index;
-
+ pub(crate) fn set_range_action(&mut self, start_index: usize, end_index: usize, action: Action) {
let range = if start_index <= end_index {
start_index..=end_index
}
@@ -134,10 +117,6 @@ impl GitInteractive {
self.selected_line_index
}
- pub(crate) const fn get_visual_start_index(&self) -> Option<usize> {
- self.visual_index_start
- }
-
pub(crate) fn get_filepath(&self) -> &str {
self.filepath.as_str()
}