From 7647345dd75f546ff9efbd5148dd922fcfde15f2 Mon Sep 17 00:00:00 2001
From: kirawi <67773714+kirawi@users.noreply.github.com>
Date: Fri, 5 Jan 2024 22:03:16 -0500
Subject: [PATCH] fix merge

---
 helix-core/src/history.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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(())