From ba8f027c189ea4cfa4d2946715fa3793cc78a036 Mon Sep 17 00:00:00 2001 From: Antar Date: Sun, 10 Nov 2024 08:47:30 +0100 Subject: [PATCH] editor: Fix toggle_comment in readonly mode (#20464) Closes #20459 Release Notes: - Fixed comments toggle in readonly mode --- crates/editor/src/editor.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index d621946dae7d867e3460fc1a199d2b16497b02d7..3851744062e7725be5126b3d58ce4ee8294a6fca 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -8782,6 +8782,9 @@ impl Editor { } pub fn toggle_comments(&mut self, action: &ToggleComments, cx: &mut ViewContext) { + if self.read_only(cx) { + return; + } let text_layout_details = &self.text_layout_details(cx); self.transact(cx, |this, cx| { let mut selections = this.selections.all::(cx);