Merge branch 'main' into terminal-hyperlinks

This commit is contained in:
Mikayla Maki 2022-09-22 23:06:07 -07:00 committed by GitHub
commit a686a9f1d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
102 changed files with 5848 additions and 1966 deletions

View file

@ -1,5 +1,4 @@
pub mod mappings;
pub mod modal;
pub mod terminal_container_view;
pub mod terminal_element;
pub mod terminal_view;
@ -32,7 +31,6 @@ use futures::{
use mappings::mouse::{
alt_scroll, grid_point, mouse_button_report, mouse_moved_report, mouse_side, scroll_report,
};
use modal::deploy_modal;
use procinfo::LocalProcessInfo;
use settings::{AlternateScroll, Settings, Shell, TerminalBlink};
@ -55,9 +53,10 @@ use thiserror::Error;
use gpui::{
geometry::vector::{vec2f, Vector2F},
keymap::Keystroke,
scene::{ClickRegionEvent, DownRegionEvent, DragRegionEvent, UpRegionEvent},
ClipboardItem, Entity, ModelContext, MouseButton, MouseMovedEvent, MutableAppContext,
ScrollWheelEvent, Task,
scene::{
ClickRegionEvent, DownRegionEvent, DragRegionEvent, ScrollWheelRegionEvent, UpRegionEvent,
},
ClipboardItem, Entity, ModelContext, MouseButton, MouseMovedEvent, MutableAppContext, Task,
};
use crate::mappings::{
@ -68,8 +67,6 @@ use lazy_static::lazy_static;
///Initialize and register all of our action handlers
pub fn init(cx: &mut MutableAppContext) {
cx.add_action(deploy_modal);
terminal_view::init(cx);
terminal_container_view::init(cx);
}
@ -1016,10 +1013,10 @@ impl Terminal {
}
///Scroll the terminal
pub fn scroll_wheel(&mut self, e: &ScrollWheelEvent, origin: Vector2F) {
pub fn scroll_wheel(&mut self, e: ScrollWheelRegionEvent, origin: Vector2F) {
let mouse_mode = self.mouse_mode(e.shift);
if let Some(scroll_lines) = self.determine_scroll_lines(e, mouse_mode) {
if let Some(scroll_lines) = self.determine_scroll_lines(&e, mouse_mode) {
if mouse_mode {
let point = grid_point(
e.position.sub(origin),
@ -1028,7 +1025,7 @@ impl Terminal {
);
if let Some(scrolls) =
scroll_report(point, scroll_lines as i32, e, self.last_content.mode)
scroll_report(point, scroll_lines as i32, &e, self.last_content.mode)
{
for scroll in scrolls {
self.pty_tx.notify(scroll);
@ -1051,7 +1048,11 @@ impl Terminal {
}
}
fn determine_scroll_lines(&mut self, e: &ScrollWheelEvent, mouse_mode: bool) -> Option<i32> {
fn determine_scroll_lines(
&mut self,
e: &ScrollWheelRegionEvent,
mouse_mode: bool,
) -> Option<i32> {
let scroll_multiplier = if mouse_mode { 1. } else { SCROLL_MULTIPLIER };
match e.phase {