Add save command

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld
2021-04-05 16:52:33 -07:00
co-authored by Nathan Sobo
parent c39c7c3eff
commit 46f8665e41
6 changed files with 192 additions and 26 deletions
+7 -2
View File
@@ -5,8 +5,9 @@ use super::{
use crate::{settings::Settings, watch, workspace};
use anyhow::Result;
use gpui::{
fonts::Properties as FontProperties, keymap::Binding, text_layout, App, AppContext, Element,
ElementBox, Entity, FontCache, ModelHandle, View, ViewContext, WeakViewHandle,
executor::BackgroundTask, fonts::Properties as FontProperties, keymap::Binding, text_layout,
App, AppContext, Element, ElementBox, Entity, FontCache, ModelHandle, MutableAppContext, View,
ViewContext, WeakViewHandle,
};
use gpui::{geometry::vector::Vector2F, TextLayoutCache};
use parking_lot::Mutex;
@@ -1178,6 +1179,10 @@ impl workspace::ItemView for BufferView {
*clone.scroll_position.lock() = *self.scroll_position.lock();
Some(clone)
}
fn save(&self, ctx: &mut MutableAppContext) -> Option<BackgroundTask<Result<()>>> {
self.buffer.update(ctx, |buffer, ctx| buffer.save(ctx))
}
}
impl Selection {