aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/view.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/view.rs')
-rw-r--r--helix-view/src/view.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index 7a239d4a..9e4c1373 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -27,9 +27,12 @@ impl JumpList {
}
pub fn push(&mut self, jump: Jump) {
- self.jumps.truncate(self.current + 1);
- self.jumps.push(jump);
- self.current += 1;
+ self.jumps.truncate(self.current);
+ // don't push duplicates
+ if self.jumps.last() != Some(&jump) {
+ self.jumps.push(jump);
+ self.current = self.jumps.len();
+ }
}
pub fn forward(&mut self, count: usize) -> Option<&Jump> {