From 4b176cadedfe47fe542e9c6e2defd34b3af984df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= <blaz@mxxn.io>
Date: Wed, 24 Mar 2021 16:56:29 +0900
Subject: [PATCH] Reset first_line when changing files.

---
 helix-view/src/editor.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index a2c3c101..33e380a0 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -90,8 +90,9 @@ impl Editor {
         use crate::tree::Layout;
         match action {
             Action::Replace => {
-                self.view_mut().doc = id;
-                // TODO: reset selection?
+                let view = self.view_mut();
+                view.doc = id;
+                view.first_line = 0;
                 return Ok(id);
             }
             Action::HorizontalSplit => {