@@ -66,11 +66,11 @@ impl PlatformWindow for TestWindow {
}
fn titlebar_height(&self) -> Pixels {
- todo!()
+ unimplemented!()
}
fn appearance(&self) -> WindowAppearance {
- todo!()
+ unimplemented!()
}
fn display(&self) -> std::rc::Rc<dyn crate::PlatformDisplay> {
@@ -99,7 +99,7 @@ impl PlatformWindow for TestWindow {
}
fn activate(&self) {
- todo!()
+ unimplemented!()
}
fn set_title(&mut self, title: &str) {
@@ -107,23 +107,23 @@ impl PlatformWindow for TestWindow {
}
fn set_edited(&mut self, _edited: bool) {
- todo!()
+ unimplemented!()
}
fn show_character_palette(&self) {
- todo!()
+ unimplemented!()
}
fn minimize(&self) {
- todo!()
+ unimplemented!()
}
fn zoom(&self) {
- todo!()
+ unimplemented!()
}
fn toggle_full_screen(&self) {
- todo!()
+ unimplemented!()
}
fn on_input(&self, callback: Box<dyn FnMut(crate::InputEvent) -> bool>) {
@@ -139,7 +139,7 @@ impl PlatformWindow for TestWindow {
}
fn on_fullscreen(&self, _callback: Box<dyn FnMut(bool)>) {
- todo!()
+ unimplemented!()
}
fn on_moved(&self, callback: Box<dyn FnMut()>) {
@@ -147,19 +147,19 @@ impl PlatformWindow for TestWindow {
}
fn on_should_close(&self, _callback: Box<dyn FnMut() -> bool>) {
- todo!()
+ unimplemented!()
}
fn on_close(&self, _callback: Box<dyn FnOnce()>) {
- todo!()
+ unimplemented!()
}
fn on_appearance_changed(&self, _callback: Box<dyn FnMut()>) {
- todo!()
+ unimplemented!()
}
fn is_topmost_for_position(&self, _position: crate::Point<Pixels>) -> bool {
- todo!()
+ unimplemented!()
}
fn draw(&self, scene: crate::Scene) {
@@ -1,10 +1,10 @@
use editor::{Cursor, HighlightedRange, HighlightedRangeLine};
use gpui::{
black, div, point, px, red, relative, transparent_black, AnyElement, AvailableSpace, Bounds,
- DispatchPhase, Element, ElementId, FocusHandle, Font, FontStyle, FontWeight, HighlightStyle,
- Hsla, InteractiveElement, InteractiveElementState, IntoElement, LayoutId, ModelContext,
- ModifiersChangedEvent, MouseButton, Pixels, Point, Rgba, ShapedLine, Size,
- StatefulInteractiveElement, Styled, TextRun, TextStyle, TextSystem, UnderlineStyle, View,
+ DispatchPhase, Element, ElementId, ElementInputHandler, FocusHandle, Font, FontStyle,
+ FontWeight, HighlightStyle, Hsla, InteractiveElement, InteractiveElementState, IntoElement,
+ LayoutId, ModelContext, ModifiersChangedEvent, MouseButton, Pixels, Point, Rgba, ShapedLine,
+ Size, StatefulInteractiveElement, Styled, TextRun, TextStyle, TextSystem, UnderlineStyle, View,
WeakModel, WhiteSpace, WindowContext,
};
use itertools::Itertools;
@@ -638,11 +638,10 @@ impl TerminalElement {
let connection = self.terminal.clone();
let mut this = self
- .on_mouse_down_weird(MouseButton::Left, {
+ .on_mouse_down(MouseButton::Left, {
let connection = connection.clone();
let focus = focus.clone();
move |e, cx| {
- dbg!("here");
cx.focus(&focus);
//todo!(context menu)
// v.context_menu.update(cx, |menu, _cx| menu.delay_cancel());
@@ -655,18 +654,18 @@ impl TerminalElement {
}
}
})
- .on_drag_event({
+ .on_mouse_move({
let connection = connection.clone();
let focus = focus.clone();
move |e, cx| {
- dbg!("here");
-
- if focus.is_focused(cx) {
- if let Some(conn_handle) = connection.upgrade() {
- conn_handle.update(cx, |terminal, cx| {
- terminal.mouse_drag(e, origin, bounds);
- cx.notify();
- })
+ if e.pressed_button.is_some() {
+ if focus.is_focused(cx) {
+ if let Some(conn_handle) = connection.upgrade() {
+ conn_handle.update(cx, |terminal, cx| {
+ terminal.mouse_drag(e, origin, bounds);
+ cx.notify();
+ })
+ }
}
}
}
@@ -685,8 +684,6 @@ impl TerminalElement {
.on_click({
let connection = connection.clone();
move |e, cx| {
- dbg!("here");
-
if e.down.button == MouseButton::Right {
let mouse_mode = if let Some(conn_handle) = connection.upgrade() {
conn_handle.update(cx, |terminal, _cx| {
@@ -707,8 +704,6 @@ impl TerminalElement {
let connection = connection.clone();
let focus = focus.clone();
move |e, cx| {
- dbg!("here");
-
if focus.is_focused(cx) {
if let Some(conn_handle) = connection.upgrade() {
conn_handle.update(cx, |terminal, cx| {
@@ -722,8 +717,6 @@ impl TerminalElement {
.on_scroll_wheel({
let connection = connection.clone();
move |e, cx| {
- dbg!("here");
-
if let Some(conn_handle) = connection.upgrade() {
conn_handle.update(cx, |terminal, cx| {
terminal.scroll_wheel(e, origin);
@@ -814,7 +807,6 @@ impl Element for TerminalElement {
state: &mut Self::State,
cx: &mut WindowContext<'_>,
) {
- dbg!(bounds);
let mut layout = self.compute_layout(bounds, cx);
let theme = cx.theme();
@@ -831,9 +823,13 @@ impl Element for TerminalElement {
let origin = bounds.origin + Point::new(layout.gutter, px(0.));
let mut this = self.register_mouse_listeners(origin, layout.mode, bounds, cx);
+
let interactivity = mem::take(&mut this.interactivity);
interactivity.paint(bounds, bounds.size, state, cx, |_, _, cx| {
+ let input_handler = ElementInputHandler::new(bounds, this.terminal_view.clone(), cx);
+ cx.handle_input(&this.focus, input_handler);
+
this.register_key_listeners(cx);
for rect in &layout.rects {
@@ -4,8 +4,8 @@ use crate::TerminalView;
use db::kvp::KEY_VALUE_STORE;
use gpui::{
actions, div, serde_json, AppContext, AsyncWindowContext, Div, Entity, EventEmitter,
- FocusHandle, FocusableView, ParentElement, Render, Subscription, Task, View, ViewContext,
- VisualContext, WeakView, WindowContext,
+ FocusHandle, FocusableView, ParentElement, Render, Styled, Subscription, Task, View,
+ ViewContext, VisualContext, WeakView, WindowContext,
};
use project::Fs;
use serde::{Deserialize, Serialize};
@@ -339,7 +339,7 @@ impl Render for TerminalPanel {
type Element = Div;
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
- div().child(self.pane.clone())
+ div().size_full().child(self.pane.clone())
}
}