From 0bc8663d366b304ac64bd604974a4bc8684815a4 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 28 Jun 2021 11:43:21 +0200 Subject: [PATCH] Remove selection set when an editor is closed --- zed/src/editor.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zed/src/editor.rs b/zed/src/editor.rs index d356d4f197..fdcc07f7db 100644 --- a/zed/src/editor.rs +++ b/zed/src/editor.rs @@ -2410,6 +2410,14 @@ pub enum Event { impl Entity for Editor { type Event = Event; + + fn release(&mut self, cx: &mut MutableAppContext) { + self.buffer.update(cx, |buffer, cx| { + buffer + .remove_selection_set(self.selection_set_id, cx) + .unwrap(); + }); + } } impl View for Editor {