Blur focused view when project becomes read-only
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
b21d91db22
commit
77e913b5a4
3 changed files with 37 additions and 20 deletions
|
@ -576,7 +576,13 @@ pub struct Workspace {
|
|||
|
||||
impl Workspace {
|
||||
pub fn new(params: &WorkspaceParams, cx: &mut ViewContext<Self>) -> Self {
|
||||
cx.observe(¶ms.project, |_, _, cx| cx.notify()).detach();
|
||||
cx.observe(¶ms.project, |_, project, cx| {
|
||||
if project.read(cx).is_read_only() {
|
||||
cx.blur();
|
||||
}
|
||||
cx.notify()
|
||||
})
|
||||
.detach();
|
||||
|
||||
let pane = cx.add_view(|_| Pane::new(params.settings.clone()));
|
||||
let pane_id = pane.id();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue