Merge branch 'master' into menus
This commit is contained in:
@@ -244,7 +244,7 @@ impl Pane {
|
||||
.with_max_width(264.0)
|
||||
.boxed(),
|
||||
)
|
||||
.boxed(),
|
||||
.named("tab"),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -263,10 +263,10 @@ impl Pane {
|
||||
.with_border(Border::bottom(1.0, border_color))
|
||||
.boxed(),
|
||||
)
|
||||
.boxed(),
|
||||
.named("filler"),
|
||||
);
|
||||
|
||||
row.boxed()
|
||||
row.named("tabs")
|
||||
}
|
||||
|
||||
fn render_modified_icon(is_modified: bool) -> ElementBox {
|
||||
@@ -304,9 +304,9 @@ impl View for Pane {
|
||||
Flex::column()
|
||||
.with_child(self.render_tabs(app))
|
||||
.with_child(Expanded::new(1.0, ChildView::new(active_item.id()).boxed()).boxed())
|
||||
.boxed()
|
||||
.named("pane")
|
||||
} else {
|
||||
Empty::new().boxed()
|
||||
Empty::new().named("pane")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,15 +2,19 @@ use super::{pane, Pane, PaneGroup, SplitDirection, Workspace};
|
||||
use crate::{settings::Settings, watch};
|
||||
use futures_core::future::LocalBoxFuture;
|
||||
use gpui::{
|
||||
color::rgbu, elements::*, keymap::Binding, AnyViewHandle, App, AppContext, Entity, ModelHandle,
|
||||
MutableAppContext, View, ViewContext, ViewHandle,
|
||||
color::rgbu, elements::*, json::to_string_pretty, keymap::Binding, AnyViewHandle, App,
|
||||
AppContext, Entity, ModelHandle, MutableAppContext, View, ViewContext, ViewHandle,
|
||||
};
|
||||
use log::{error, info};
|
||||
use std::{collections::HashSet, path::PathBuf};
|
||||
|
||||
pub fn init(app: &mut App) {
|
||||
app.add_action("workspace:save", WorkspaceView::save_active_item);
|
||||
app.add_bindings(vec![Binding::new("cmd-s", "workspace:save", None)]);
|
||||
app.add_action("workspace:debug_elements", WorkspaceView::debug_elements);
|
||||
app.add_bindings(vec![
|
||||
Binding::new("cmd-s", "workspace:save", None),
|
||||
Binding::new("cmd-alt-i", "workspace:debug_elements", None),
|
||||
]);
|
||||
}
|
||||
|
||||
pub trait ItemView: View {
|
||||
@@ -251,6 +255,21 @@ impl WorkspaceView {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn debug_elements(&mut self, _: &(), ctx: &mut ViewContext<Self>) {
|
||||
match to_string_pretty(&ctx.debug_elements()) {
|
||||
Ok(json) => {
|
||||
ctx.app_mut().copy(&json);
|
||||
log::info!(
|
||||
"copied {:.1} KiB of element debug JSON to the clipboard",
|
||||
json.len() as f32 / 1024.
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
log::error!("error debugging elements: {}", error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn workspace_updated(&mut self, _: ModelHandle<Workspace>, ctx: &mut ViewContext<Self>) {
|
||||
ctx.notify();
|
||||
}
|
||||
@@ -358,7 +377,7 @@ impl View for WorkspaceView {
|
||||
.boxed(),
|
||||
)
|
||||
.with_background_color(rgbu(0xea, 0xea, 0xeb))
|
||||
.boxed()
|
||||
.named("workspace")
|
||||
}
|
||||
|
||||
fn on_focus(&mut self, ctx: &mut ViewContext<Self>) {
|
||||
|
||||
Reference in New Issue
Block a user