summaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorath32021-11-04 08:57:04 +0000
committerGitHub2021-11-04 08:57:04 +0000
commitaa4d0b464645b2834d7af483d17fdc11d61d994d (patch)
tree0a86093a0e28e5a64b23fc91b19063a5e404ec80 /helix-view/src
parent7b65a6d687bbf4d12de020a7785082277804bbd3 (diff)
Fix crash on changing from empty scratch buffer to itself (#975)
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 633e2541..63a4ab29 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -240,6 +240,8 @@ impl Editor {
let remove_empty_scratch = !doc.is_modified()
// If the buffer has no path and is not modified, it is an empty scratch buffer.
&& doc.path().is_none()
+ // If the buffer we are changing to is not this buffer
+ && id != doc.id
// Ensure the buffer is not displayed in any other splits.
&& !self
.tree