Properly handle Cmd press for terminal highlights

This commit is contained in:
Kirill Bulatov 2023-07-14 18:26:35 +03:00
parent 75d900704e
commit f52722b6a4
3 changed files with 36 additions and 9 deletions

View file

@ -392,10 +392,6 @@ impl TerminalElement {
let mut region = MouseRegion::new::<Self>(cx.view_id(), 0, visible_bounds);
// 1. Get file:linenumber syntax working ✔️
// 2. Switch terminal to look for word boundaries, on cmd-hover
// 3. Send those query strings to the resolver thing above
// Terminal Emulator controlled behavior:
region = region
// Start selections

View file

@ -11,7 +11,7 @@ use gpui::{
geometry::vector::Vector2F,
impl_actions,
keymap_matcher::{KeymapContext, Keystroke},
platform::KeyDownEvent,
platform::{KeyDownEvent, ModifiersChangedEvent},
AnyElement, AnyViewHandle, AppContext, Element, Entity, ModelHandle, Task, View, ViewContext,
ViewHandle, WeakViewHandle,
};
@ -159,6 +159,7 @@ impl TerminalView {
}
}
Event::Open(url) => {
// TODO kb
// Get a workspace pointer from the new() function above
// Guess for project path or url
// Either run open buffer action OR platform open depending on whatever happens
@ -399,6 +400,20 @@ impl View for TerminalView {
cx.notify();
}
fn modifiers_changed(
&mut self,
event: &ModifiersChangedEvent,
cx: &mut ViewContext<Self>,
) -> bool {
let handled = self
.terminal()
.update(cx, |term, _| term.try_modifiers_change(&event.modifiers));
if handled {
cx.notify();
}
handled
}
fn key_down(&mut self, event: &KeyDownEvent, cx: &mut ViewContext<Self>) -> bool {
self.clear_bel(cx);
self.pause_cursor_blinking(cx);