on master help sign in
Fix crash on changing from empty scratch buffer to itself (#975)
aa4d0b4ath3
helix-view/src/editor.rs+2
@@ -240,6 +240,8 @@ impl Editor {
240 let remove_empty_scratch = !doc.is_modified()
240 let remove_empty_scratch = !doc.is_modified()
241 // If the buffer has no path and is not modified, it is an empty scratch buffer.
241 // If the buffer has no path and is not modified, it is an empty scratch buffer.
242 && doc.path().is_none()
242 && doc.path().is_none()
243+ // If the buffer we are changing to is not this buffer
244+ && id != doc.id
243 // Ensure the buffer is not displayed in any other splits.
245 // Ensure the buffer is not displayed in any other splits.
244 && !self
246 && !self
245 .tree
247 .tree