From 4e729dea023ca31d0a5ad8fb0b73496cfea3b243 Mon Sep 17 00:00:00 2001
From: RoloEdits <RoloEdits@gmail.com>
Date: Mon, 19 Aug 2024 15:28:59 -0700
Subject: [PATCH] fix: ensure view is initiated for jump_* commands (#11529)

---
 helix-term/src/commands.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 9ccd8ea1..6e037a47 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -5138,6 +5138,8 @@ fn jump_forward(cx: &mut Context) {
         }
 
         doc.set_selection(view.id, selection);
+        // Document we switch to might not have been opened in the view before
+        doc.ensure_view_init(view.id);
         view.ensure_cursor_in_view_center(doc, config.scrolloff);
     };
 }
@@ -5158,6 +5160,8 @@ fn jump_backward(cx: &mut Context) {
         }
 
         doc.set_selection(view.id, selection);
+        // Document we switch to might not have been opened in the view before
+        doc.ensure_view_init(view.id);
         view.ensure_cursor_in_view_center(doc, config.scrolloff);
     };
 }