WIP
co-authored-by: conrad <conrad@zed.dev> co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
parent
6985b70859
commit
2c4d83c9af
96 changed files with 1926 additions and 1955 deletions
|
@ -9,10 +9,10 @@ pub mod terminal_panel;
|
|||
// use crate::terminal_element::TerminalElement;
|
||||
use editor::{scroll::autoscroll::Autoscroll, Editor};
|
||||
use gpui::{
|
||||
actions, div, Action, AnyElement, AppContext, DispatchPhase, Div, Element, EventEmitter,
|
||||
FocusEvent, FocusHandle, Focusable, FocusableElement, FocusableView, InputHandler,
|
||||
InteractiveElement, KeyDownEvent, Keystroke, Model, MouseButton, ParentElement, Pixels, Render,
|
||||
SharedString, Styled, Task, View, ViewContext, VisualContext, WeakView,
|
||||
actions, div, Action, AnyElement, AppContext, Div, Element, EventEmitter, FocusEvent,
|
||||
FocusHandle, Focusable, FocusableElement, FocusableView, InputHandler, InteractiveElement,
|
||||
KeyDownEvent, Keystroke, Model, MouseButton, MouseDownEvent, ParentElement, Pixels, Render,
|
||||
SharedString, Styled, Task, View, ViewContext, VisualContext, WeakView, WindowContext,
|
||||
};
|
||||
use language::Bias;
|
||||
use persistence::TERMINAL_DB;
|
||||
|
@ -84,7 +84,7 @@ pub struct TerminalView {
|
|||
has_new_content: bool,
|
||||
//Currently using iTerm bell, show bell emoji in tab until input is received
|
||||
has_bell: bool,
|
||||
context_menu: Option<View<ContextMenu<Self>>>,
|
||||
context_menu: Option<View<ContextMenu>>,
|
||||
blink_state: bool,
|
||||
blinking_on: bool,
|
||||
blinking_paused: bool,
|
||||
|
@ -505,12 +505,7 @@ pub fn regex_search_for_query(query: &project::search::SearchQuery) -> Option<Re
|
|||
}
|
||||
|
||||
impl TerminalView {
|
||||
fn key_down(
|
||||
&mut self,
|
||||
event: &KeyDownEvent,
|
||||
_dispatch_phase: DispatchPhase,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
fn key_down(&mut self, event: &KeyDownEvent, cx: &mut ViewContext<Self>) {
|
||||
self.clear_bel(cx);
|
||||
self.pause_cursor_blinking(cx);
|
||||
|
||||
|
@ -537,8 +532,8 @@ impl TerminalView {
|
|||
}
|
||||
}
|
||||
|
||||
impl Render<Self> for TerminalView {
|
||||
type Element = Focusable<Self, Div<Self>>;
|
||||
impl Render for TerminalView {
|
||||
type Element = Focusable<Div>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
let terminal_handle = self.terminal.clone().downgrade();
|
||||
|
@ -552,14 +547,14 @@ impl Render<Self> for TerminalView {
|
|||
div()
|
||||
.z_index(0)
|
||||
.absolute()
|
||||
.on_key_down(Self::key_down)
|
||||
.on_action(TerminalView::send_text)
|
||||
.on_action(TerminalView::send_keystroke)
|
||||
.on_action(TerminalView::copy)
|
||||
.on_action(TerminalView::paste)
|
||||
.on_action(TerminalView::clear)
|
||||
.on_action(TerminalView::show_character_palette)
|
||||
.on_action(TerminalView::select_all)
|
||||
.on_key_down(cx.listener(Self::key_down))
|
||||
.on_action(cx.listener(TerminalView::send_text))
|
||||
.on_action(cx.listener(TerminalView::send_keystroke))
|
||||
.on_action(cx.listener(TerminalView::copy))
|
||||
.on_action(cx.listener(TerminalView::paste))
|
||||
.on_action(cx.listener(TerminalView::clear))
|
||||
.on_action(cx.listener(TerminalView::show_character_palette))
|
||||
.on_action(cx.listener(TerminalView::select_all))
|
||||
// todo!()
|
||||
.child(
|
||||
"TERMINAL HERE", // TerminalElement::new(
|
||||
|
@ -569,10 +564,13 @@ impl Render<Self> for TerminalView {
|
|||
// self.can_navigate_to_selected_word,
|
||||
// )
|
||||
)
|
||||
.on_mouse_down(MouseButton::Right, |this, event, cx| {
|
||||
this.deploy_context_menu(event.position, cx);
|
||||
cx.notify();
|
||||
}),
|
||||
.on_mouse_down(
|
||||
MouseButton::Right,
|
||||
cx.listener(|this, event: &MouseDownEvent, cx| {
|
||||
this.deploy_context_menu(event.position, cx);
|
||||
cx.notify();
|
||||
}),
|
||||
),
|
||||
)
|
||||
.children(
|
||||
self.context_menu
|
||||
|
@ -580,8 +578,8 @@ impl Render<Self> for TerminalView {
|
|||
.map(|context_menu| div().z_index(1).absolute().child(context_menu)),
|
||||
)
|
||||
.track_focus(&self.focus_handle)
|
||||
.on_focus_in(Self::focus_in)
|
||||
.on_focus_out(Self::focus_out)
|
||||
.on_focus_in(cx.listener(Self::focus_in))
|
||||
.on_focus_out(cx.listener(Self::focus_out))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -746,11 +744,7 @@ impl Item for TerminalView {
|
|||
Some(self.terminal().read(cx).title().into())
|
||||
}
|
||||
|
||||
fn tab_content<T: 'static>(
|
||||
&self,
|
||||
_detail: Option<usize>,
|
||||
cx: &gpui::AppContext,
|
||||
) -> AnyElement<T> {
|
||||
fn tab_content(&self, _detail: Option<usize>, cx: &WindowContext) -> AnyElement {
|
||||
let title = self.terminal().read(cx).title();
|
||||
|
||||
div()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue