Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Fix toggle_comment in readonly mode (#20464)

Antarba8f027c189e
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index d621946dae7..3851744062e 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<Self>) {
+ 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::<MultiBufferPoint>(cx);