Restored chat_panel, just in case

This commit is contained in:
Mikayla Maki 2022-10-19 11:42:29 -07:00
commit 4c2f8406c7
97 changed files with 2635 additions and 1770 deletions

View file

@ -53,7 +53,7 @@ use thiserror::Error;
use gpui::{
geometry::vector::{vec2f, Vector2F},
keymap::Keystroke,
scene::{DownRegionEvent, DragRegionEvent, ScrollWheelRegionEvent, UpRegionEvent},
scene::{MouseDown, MouseDrag, MouseScrollWheel, MouseUp},
ClipboardItem, Entity, ModelContext, MouseButton, MouseMovedEvent, MutableAppContext, Task,
};
@ -971,7 +971,7 @@ impl Terminal {
}
}
pub fn mouse_drag(&mut self, e: DragRegionEvent, origin: Vector2F) {
pub fn mouse_drag(&mut self, e: MouseDrag, origin: Vector2F) {
let position = e.position.sub(origin);
self.last_mouse_position = Some(position);
@ -997,7 +997,7 @@ impl Terminal {
}
}
fn drag_line_delta(&mut self, e: DragRegionEvent) -> Option<f32> {
fn drag_line_delta(&mut self, e: MouseDrag) -> Option<f32> {
//TODO: Why do these need to be doubled? Probably the same problem that the IME has
let top = e.region.origin_y() + (self.last_content.size.line_height * 2.);
let bottom = e.region.lower_left().y() - (self.last_content.size.line_height * 2.);
@ -1011,7 +1011,7 @@ impl Terminal {
Some(scroll_delta)
}
pub fn mouse_down(&mut self, e: &DownRegionEvent, origin: Vector2F) {
pub fn mouse_down(&mut self, e: &MouseDown, origin: Vector2F) {
let position = e.position.sub(origin);
let point = grid_point(
position,
@ -1050,7 +1050,7 @@ impl Terminal {
}
}
pub fn mouse_up(&mut self, e: &UpRegionEvent, origin: Vector2F, cx: &mut ModelContext<Self>) {
pub fn mouse_up(&mut self, e: &MouseUp, origin: Vector2F, cx: &mut ModelContext<Self>) {
let settings = cx.global::<Settings>();
let copy_on_select = settings
.terminal_overrides
@ -1095,7 +1095,7 @@ impl Terminal {
}
///Scroll the terminal
pub fn scroll_wheel(&mut self, e: ScrollWheelRegionEvent, origin: Vector2F) {
pub fn scroll_wheel(&mut self, e: MouseScrollWheel, origin: Vector2F) {
let mouse_mode = self.mouse_mode(e.shift);
if let Some(scroll_lines) = self.determine_scroll_lines(&e, mouse_mode) {
@ -1134,11 +1134,7 @@ impl Terminal {
self.hyperlink_from_position(self.last_mouse_position);
}
fn determine_scroll_lines(
&mut self,
e: &ScrollWheelRegionEvent,
mouse_mode: bool,
) -> Option<i32> {
fn determine_scroll_lines(&mut self, e: &MouseScrollWheel, mouse_mode: bool) -> Option<i32> {
let scroll_multiplier = if mouse_mode { 1. } else { SCROLL_MULTIPLIER };
match e.phase {