Only allow save_as for pane if can_save_as is true (#25028)
When saving an item, some logic is done to determine whether one can save it. In the special case where the intent is to `SaveAs`, it was previously allowed to proceed as long as the buffer was a singleton (presumably since it only makes sense to provide a save path for a single file). However, we need to _also_ check that this item can be "saved as" at all. For this, we resurrect the `ItemHandle`/`Item` trait method `can_save_as`. We have given it the default implementation of returning `false`, and then overridden this in the implementation for `TerminalView`. Closes #25023 Release Notes: - Fixed crash when trying to save terminal buffer --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
62a11b047d
commit
bb53ad9862
4 changed files with 38 additions and 13 deletions
|
@ -706,6 +706,10 @@ impl Item for Editor {
|
|||
self.buffer.read(cx).is_singleton()
|
||||
}
|
||||
|
||||
fn can_save_as(&self, cx: &App) -> bool {
|
||||
self.buffer.read(cx).is_singleton()
|
||||
}
|
||||
|
||||
fn clone_on_split(
|
||||
&self,
|
||||
_workspace_id: Option<WorkspaceId>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue