Allow editor to be saved when in multi-buffer mode

Also, this commit enables the customization of the title in a multi-buffer.
When specified, it will take precedence over a filename (or "untitled").
This commit is contained in:
Antonio Scandurra
2022-02-10 09:35:19 +01:00
parent 9ea535986f
commit dd223f93ec
4 changed files with 35 additions and 17 deletions
+3 -3
View File
@@ -218,7 +218,7 @@ impl ItemView for Editor {
}
fn can_save(&self, cx: &AppContext) -> bool {
self.project_path(cx).is_some()
!self.buffer().read(cx).is_singleton() || self.project_path(cx).is_some()
}
fn save(&mut self, cx: &mut ViewContext<Self>) -> Task<Result<()>> {
@@ -235,8 +235,8 @@ impl ItemView for Editor {
})
}
fn can_save_as(&self, _: &AppContext) -> bool {
true
fn can_save_as(&self, cx: &AppContext) -> bool {
self.buffer().read(cx).is_singleton()
}
fn save_as(