@@ -845,8 +845,6 @@ actions!(
UnwrapSyntaxNode,
/// Wraps selections in tag specified by language.
WrapSelectionsInTag,
- /// Toggles read-only mode for the current buffer.- ToggleReadOnly,
]
);
@@ -281,6 +281,8 @@ actions!(
ToggleRightDock,
/// Toggles zoom on the active pane.
ToggleZoom,
+ /// Toggles read-only mode for the active item (if supported by that item).
+ ToggleReadOnlyFile,
/// Zooms in on the active pane.
ZoomIn,
/// Zooms out of the active pane.
@@ -6249,6 +6251,14 @@ impl Workspace {
cx.propagate();
},
))
+ .on_action(
+ cx.listener(|workspace, _: &ToggleReadOnlyFile, window, cx| {
+ let pane = workspace.active_pane().clone();
+ if let Some(item) = pane.read(cx).active_item() {
+ item.toggle_read_only(window, cx);
+ }
+ }),
+ )
.on_action(cx.listener(Workspace::cancel))
}