From 6f64ac32bf33793e792e8cfa9b02f0a8ffcb44b1 Mon Sep 17 00:00:00 2001 From: Dominic Gerhauser Date: Tue, 24 Sep 2024 13:45:56 +0200 Subject: [PATCH] cursor --- src/terminal_box.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/terminal_box.rs b/src/terminal_box.rs index 9372781..ca9711f 100644 --- a/src/terminal_box.rs +++ b/src/terminal_box.rs @@ -229,11 +229,24 @@ where let x = p.x - self.padding.left; let y = p.y - self.padding.top; + if x >= 0.0 && x < buffer_size.0.unwrap_or(0.0) && y >= 0.0 && y < buffer_size.1.unwrap_or(0.0) { + let col = x / terminal.size().cell_width; + let row = y / terminal.size().cell_height; + let location = terminal + .viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize))); + let term = terminal.term.lock(); + let hyperlink = term.grid()[location].hyperlink(); + drop(term); + dbg!(&hyperlink); + if hyperlink.is_some() { + return mouse::Interaction::Pointer; + } + return mouse::Interaction::Text; } }