From 415e28e2d3719ae1335636f501f3f93cb71a5c0b Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Thu, 7 Jul 2022 14:54:13 -0700 Subject: [PATCH] Fixed merge conflict --- crates/terminal/src/terminal.rs | 10 +++------- crates/terminal/src/terminal_element.rs | 22 +++++++++++++--------- styles/package-lock.json | 1 - 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index c2df86de6144ed89f03fb01b179524dd594f7251..dbbd1341e653598669c26949c62a81b6cc61414a 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -9,11 +9,8 @@ use alacritty_terminal::{ Term, }; -<<<<<<< HEAD -use dirs::home_dir; -======= use color_translation::{get_color_at_index, to_alac_rgb}; ->>>>>>> 3fe0d66d (Began working on selections, refactored colors) +use dirs::home_dir; use futures::{ channel::mpsc::{unbounded, UnboundedSender}, StreamExt, @@ -475,13 +472,12 @@ fn get_working_directory(wt: &LocalWorktree) -> Option { #[cfg(test)] mod tests { - use std::{path::Path, sync::atomic::AtomicUsize, time::Duration}; - use super::*; use alacritty_terminal::{grid::GridIterator, term::cell::Cell}; use gpui::TestAppContext; use itertools::Itertools; use project::{FakeFs, Fs, RealFs, RemoveOptions, Worktree}; + use std::{path::Path, sync::atomic::AtomicUsize, time::Duration}; ///Basic integration test, can we get the terminal to show up, execute a command, //and produce noticable output? @@ -489,7 +485,6 @@ mod tests { async fn test_terminal(cx: &mut TestAppContext) { let terminal = cx.add_view(Default::default(), |cx| Terminal::new(cx, None)); cx.set_condition_duration(Duration::from_secs(2)); - terminal.update(cx, |terminal, cx| { terminal.write_to_pty(&Input(("expr 3 + 4".to_string()).to_string()), cx); terminal.carriage_return(&Return, cx); @@ -499,6 +494,7 @@ mod tests { .condition(cx, |terminal, _cx| { let term = terminal.term.clone(); let content = grid_as_str(term.lock().renderable_content().display_iter); + dbg!(&content); content.contains("7") }) .await; diff --git a/crates/terminal/src/terminal_element.rs b/crates/terminal/src/terminal_element.rs index a339c2c6f942c18f1fcb8384ffe6a9471d1140d4..ad928068ed3f94077e4f560407a994795ed71387 100644 --- a/crates/terminal/src/terminal_element.rs +++ b/crates/terminal/src/terminal_element.rs @@ -247,7 +247,7 @@ impl Element for TerminalEl { //TODO: Better way of doing this? let mutex1 = terminal_mutex.clone(); - let _mutex2 = terminal_mutex.clone(); + let mutex2 = terminal_mutex.clone(); cx.scene.push_mouse_region(MouseRegion { view_id: self.view.id(), @@ -269,14 +269,18 @@ impl Element for TerminalEl { cx.focus_parent_view() })), bounds: visible_bounds, - drag: Some(Rc::new(move |_delta, _cx| { - // let (point, side) = mouse_to_cell_data(pos, origin, cur_size, display_offset); - - // let mut term = mutex2.lock(); - // if let Some(mut selection) = term.selection.take() { - // selection.update(point, side); - // term.selection = Some(selection); - // } + drag: Some(Rc::new(move |_delta, pos, cx| { + let (point, side) = mouse_to_cell_data(pos, origin, cur_size, display_offset); + + let mut term = mutex2.lock(); + if let Some(mut selection) = term.selection.take() { + selection.update(point, side); + term.selection = Some(selection); + } else { + term.selection = Some(Selection::new(SelectionType::Simple, point, side)); + } + + cx.notify() })), ..Default::default() }); diff --git a/styles/package-lock.json b/styles/package-lock.json index 49304dc2fa98dfec942bf6687be56cefc13cdf80..2eb6d3a1bfaeaa206f0cc8a0a03efa0387d144c2 100644 --- a/styles/package-lock.json +++ b/styles/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "styles", "version": "1.0.0", "license": "ISC", "dependencies": {