summaryrefslogtreecommitdiffstats
path: root/src/op.rs
diff options
context:
space:
mode:
authorkyoheiu <kyoheiu@outlook.com>2022-05-21 05:02:36 +0900
committerkyoheiu <kyoheiu@outlook.com>2022-05-21 05:02:36 +0900
commit192930740e8e50840c3516f0c9191d741e1f0b8c (patch)
treeef5c89de16aaf3a893d855fb4a74765a58569a07 /src/op.rs
parent72686c19b3d202dde4c373f8b302fb34e39267ec (diff)
Refactor: Extract undo
Diffstat (limited to 'src/op.rs')
-rw-r--r--src/op.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/op.rs b/src/op.rs
index 25380a3..5e5d698 100644
--- a/src/op.rs
+++ b/src/op.rs
@@ -4,7 +4,7 @@ use std::path::PathBuf;
#[derive(Debug, Clone)]
pub struct Operation {
- pub count: usize,
+ pub pos: usize,
pub op_list: Vec<OpKind>,
}
@@ -38,10 +38,10 @@ pub struct RenamedFile {
impl Operation {
/// Discard undone operations when new one is pushed.
pub fn branch(&mut self) {
- if self.count == 0 {
+ if self.pos == 0 {
return;
}
- for _i in 0..self.count {
+ for _i in 0..self.pos {
self.op_list.pop();
}
}
@@ -49,7 +49,7 @@ impl Operation {
pub fn push(&mut self, op: OpKind) {
log(&op);
self.op_list.push(op);
- self.count = 0;
+ self.pos = 0;
}
}