diff options
author | kyoheiu <kyoheiu@outlook.com> | 2022-05-21 05:02:36 +0900 |
---|---|---|
committer | kyoheiu <kyoheiu@outlook.com> | 2022-05-21 05:02:36 +0900 |
commit | 192930740e8e50840c3516f0c9191d741e1f0b8c (patch) | |
tree | ef5c89de16aaf3a893d855fb4a74765a58569a07 /src/op.rs | |
parent | 72686c19b3d202dde4c373f8b302fb34e39267ec (diff) |
Refactor: Extract undo
Diffstat (limited to 'src/op.rs')
-rw-r--r-- | src/op.rs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; } } |