diff --git a/helix-core/src/history.rs b/helix-core/src/history.rs index 4a6f251041e9f..f2bd835cef91b 100644 --- a/helix-core/src/history.rs +++ b/helix-core/src/history.rs @@ -293,7 +293,10 @@ impl History { NonZeroUsize::new(other.revisions.len()); other.revisions.push(r); } - self.current += offset; + + if self.current >= n { + self.current += offset; + } self.revisions = other.revisions; Ok(())