Skip to content

Commit

Permalink
cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
leb-kuchen committed Sep 24, 2024
1 parent 237459a commit 6f64ac3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/terminal_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 6f64ac3

Please sign in to comment.