diff options
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/document.rs | 5 | ||||
-rw-r--r-- | helix-view/src/view.rs | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index abc829c0..6e73104a 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -275,6 +275,11 @@ impl Document { } #[inline] + pub fn id(&self) -> DocumentId { + self.id + } + + #[inline] pub fn mode(&self) -> Mode { self.mode } 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> { |