on master help sign in
Fix crash on changing from empty scratch buffer to itself (#975)
commitaa4d0b464645b2834d7af483d17fdc11d61d994d authorath3 <45574139+ath3@users.noreply.github.com> dateThu 4 Nov 2021, 09:57 (5 years ago) parent7b65a6d
1 file changed+2
helix-view/src/editor.rs+2
helix-view/src/editor.rs+2
@@ -240,6 +240,8 @@ impl Editor {
240240 let remove_empty_scratch = !doc.is_modified()
241241 // If the buffer has no path and is not modified, it is an empty scratch buffer.
242242 && doc.path().is_none()
243+ // If the buffer we are changing to is not this buffer
244+ && id != doc.id
243245 // Ensure the buffer is not displayed in any other splits.
244246 && !self
245247 .tree