Terminal mouse improvements (#25104)

Closes #24911
Closes #17983
Closes #7073

Release Notes:

- Terminal: Fix cmd-click on links/files when terminal is not focused
- Terminal: Remove hover treatment after Zed hides/re-opens

---------

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
Conrad Irwin 2025-02-18 14:10:10 -07:00 committed by GitHub
parent b1872e3afd
commit 60a44359e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 229 additions and 230 deletions

View file

@ -22,7 +22,7 @@ use alacritty_terminal::{
term::Config,
vte::ansi::Processor,
};
use gpui::{canvas, size, ClipboardItem, Entity, FontStyle, TextStyle, WhiteSpace};
use gpui::{canvas, size, Bounds, ClipboardItem, Entity, FontStyle, TextStyle, WhiteSpace};
use language::Buffer;
use settings::Settings as _;
use terminal_view::terminal_element::TerminalElement;
@ -85,7 +85,7 @@ pub fn text_style(window: &mut Window, cx: &mut App) -> TextStyle {
}
/// Returns the default terminal size for the terminal output.
pub fn terminal_size(window: &mut Window, cx: &mut App) -> terminal::TerminalSize {
pub fn terminal_size(window: &mut Window, cx: &mut App) -> terminal::TerminalBounds {
let text_style = text_style(window, cx);
let text_system = window.text_system();
@ -106,10 +106,13 @@ pub fn terminal_size(window: &mut Window, cx: &mut App) -> terminal::TerminalSiz
let width = columns as f32 * cell_width;
let height = num_lines as f32 * window.line_height();
terminal::TerminalSize {
terminal::TerminalBounds {
cell_width,
line_height,
size: size(width, height),
bounds: Bounds {
origin: gpui::Point::default(),
size: size(width, height),
},
}
}
@ -277,10 +280,10 @@ impl Render for TerminalOutput {
for rect in rects {
rect.paint(
bounds.origin,
&terminal::TerminalSize {
&terminal::TerminalBounds {
cell_width,
line_height: text_line_height,
size: bounds.size,
bounds,
},
window,
);
@ -289,10 +292,10 @@ impl Render for TerminalOutput {
for cell in cells {
cell.paint(
bounds.origin,
&terminal::TerminalSize {
&terminal::TerminalBounds {
cell_width,
line_height: text_line_height,
size: bounds.size,
bounds,
},
bounds,
window,