Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Merge branch 'main' into zed2-breadcrumbs

Julia13f4cc563c03
diff --cc crates/workspace2/src/pane.rs
index d08a5170c1c,f16a4fcf09e..8f30d0573fc
--- a/crates/workspace2/src/pane.rs
+++ b/crates/workspace2/src/pane.rs
@@@ -7,15 -7,14 +7,15 @@@ use crate::
use anyhow::Result;
use collections::{HashMap, HashSet, VecDeque};
use gpui::{
- actions, prelude::*, Action, AppContext, AsyncWindowContext, Div, EntityId, EventEmitter,
- FocusHandle, Focusable, FocusableView, Model, Pixels, Point, PromptLevel, Render, Task, View,
- ViewContext, VisualContext, WeakView, WindowContext,
+ actions, overlay, prelude::*, Action, AnchorCorner, AnyWeakView, AppContext,
+ AsyncWindowContext, DismissEvent, Div, EntityId, EventEmitter, FocusHandle, Focusable,
+ FocusableView, Model, Pixels, Point, PromptLevel, Render, Task, View, ViewContext,
+ VisualContext, WeakView, WindowContext,
};
use parking_lot::Mutex;
- use project2::{Project, ProjectEntryId, ProjectPath};
+ use project::{Project, ProjectEntryId, ProjectPath};
use serde::Deserialize;
- use settings2::Settings;
+ use settings::Settings;
use std::{
any::Any,
cmp, fmt, mem,
@@@ -2077,77 -1965,33 +2107,73 @@@ impl Render for Pane
v_stack()
.key_context("Pane")
.track_focus(&self.focus_handle)
+ .on_focus_in({
+ let this = this.clone();
+ move |event, cx| {
+ this.update(cx, |this, cx| this.focus_in(cx)).ok();
+ }
+ })
+ .on_focus_out({
+ let this = this.clone();
+ move |event, cx| {
+ this.update(cx, |this, cx| this.focus_out(cx)).ok();
+ }
+ })
- .on_action(cx.listener(|pane: &mut Pane, _: &SplitLeft, cx| {
- pane.split(SplitDirection::Left, cx)
- }))
+ .on_action(cx.listener(|pane, _: &SplitLeft, cx| pane.split(SplitDirection::Left, cx)))
+ .on_action(cx.listener(|pane, _: &SplitUp, cx| pane.split(SplitDirection::Up, cx)))
.on_action(
- cx.listener(|pane: &mut Pane, _: &SplitUp, cx| pane.split(SplitDirection::Up, cx)),
+ cx.listener(|pane, _: &SplitRight, cx| pane.split(SplitDirection::Right, cx)),
)
- .on_action(cx.listener(|pane: &mut Pane, _: &SplitRight, cx| {
- pane.split(SplitDirection::Right, cx)
- }))
- .on_action(cx.listener(|pane: &mut Pane, _: &SplitDown, cx| {
- pane.split(SplitDirection::Down, cx)
- }))
+ .on_action(cx.listener(|pane, _: &SplitDown, cx| pane.split(SplitDirection::Down, cx)))
+ .on_action(cx.listener(|pane, _: &GoBack, cx| pane.navigate_backward(cx)))
+ .on_action(cx.listener(|pane, _: &GoForward, cx| pane.navigate_forward(cx)))
- // cx.add_action(Pane::toggle_zoom);
- // cx.add_action(|pane: &mut Pane, action: &ActivateItem, cx| {
- // pane.activate_item(action.0, true, true, cx);
- // });
- // cx.add_action(|pane: &mut Pane, _: &ActivateLastItem, cx| {
- // pane.activate_item(pane.items.len() - 1, true, true, cx);
- // });
- // cx.add_action(|pane: &mut Pane, _: &ActivatePrevItem, cx| {
- // pane.activate_prev_item(true, cx);
- // });
- // cx.add_action(|pane: &mut Pane, _: &ActivateNextItem, cx| {
- // pane.activate_next_item(true, cx);
- // });
- // cx.add_async_action(Pane::close_active_item);
- // cx.add_async_action(Pane::close_inactive_items);
- // cx.add_async_action(Pane::close_clean_items);
- // cx.add_async_action(Pane::close_items_to_the_left);
- // cx.add_async_action(Pane::close_items_to_the_right);
- // cx.add_async_action(Pane::close_all_items);
+ .on_action(cx.listener(Pane::toggle_zoom))
+ .on_action(cx.listener(|pane: &mut Pane, action: &ActivateItem, cx| {
+ pane.activate_item(action.0, true, true, cx);
+ }))
+ .on_action(cx.listener(|pane: &mut Pane, _: &ActivateLastItem, cx| {
+ pane.activate_item(pane.items.len() - 1, true, true, cx);
+ }))
+ .on_action(cx.listener(|pane: &mut Pane, _: &ActivatePrevItem, cx| {
+ pane.activate_prev_item(true, cx);
+ }))
+ .on_action(cx.listener(|pane: &mut Pane, _: &ActivateNextItem, cx| {
+ pane.activate_next_item(true, cx);
+ }))
+ .on_action(
+ cx.listener(|pane: &mut Self, action: &CloseActiveItem, cx| {
+ pane.close_active_item(action, cx)
+ .map(|task| task.detach_and_log_err(cx));
+ }),
+ )
+ .on_action(
+ cx.listener(|pane: &mut Self, action: &CloseInactiveItems, cx| {
+ pane.close_inactive_items(action, cx)
+ .map(|task| task.detach_and_log_err(cx));
+ }),
+ )
+ .on_action(
+ cx.listener(|pane: &mut Self, action: &CloseCleanItems, cx| {
+ pane.close_clean_items(action, cx)
+ .map(|task| task.detach_and_log_err(cx));
+ }),
+ )
+ .on_action(
+ cx.listener(|pane: &mut Self, action: &CloseItemsToTheLeft, cx| {
+ pane.close_items_to_the_left(action, cx)
+ .map(|task| task.detach_and_log_err(cx));
+ }),
+ )
+ .on_action(
+ cx.listener(|pane: &mut Self, action: &CloseItemsToTheRight, cx| {
+ pane.close_items_to_the_right(action, cx)
+ .map(|task| task.detach_and_log_err(cx));
+ }),
+ )
+ .on_action(cx.listener(|pane: &mut Self, action: &CloseAllItems, cx| {
+ pane.close_all_items(action, cx)
+ .map(|task| task.detach_and_log_err(cx));
+ }))
.size_full()
.on_action(
cx.listener(|pane: &mut Self, action: &CloseActiveItem, cx| {