Skip to content

Commit f3d1432

Browse files
authored
fix(webgl2): honor Modifier::REVERSED for Color::Reset (#127)
1 parent d72116d commit f3d1432

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/backend/webgl2.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl WebGl2Backend {
523523
}
524524
MouseEventType::MouseMove => {
525525
// Handle cursor style changes on hover
526-
let is_over_hyperlink = Self::is_over_hyperlink_static(
526+
let is_over_hyperlink = Self::is_over_hyperlink(
527527
hyperlink_cells_move.clone(),
528528
grid,
529529
event.col,
@@ -546,8 +546,8 @@ impl WebGl2Backend {
546546
Ok(mouse_handler)
547547
}
548548

549-
/// Checks if the given coordinates are over a hyperlink (static version for use in closures).
550-
fn is_over_hyperlink_static(
549+
/// Checks if the given coordinates are over a hyperlink.
550+
fn is_over_hyperlink(
551551
hyperlink_cells: Rc<RefCell<BitVec>>,
552552
grid: &beamterm_renderer::TerminalGrid,
553553
col: u16,
@@ -764,18 +764,14 @@ fn find_hyperlink_bounds(
764764

765765
/// Resolves foreground and background colors for a [`Cell`].
766766
fn resolve_fg_bg_colors(cell: &Cell) -> (u32, u32) {
767-
let mut fg = cell.fg;
768-
let mut bg = cell.bg;
767+
let mut fg = to_rgb(cell.fg, 0xffffff);
768+
let mut bg = to_rgb(cell.bg, 0x000000);
769769

770770
if cell.modifier.contains(Modifier::REVERSED) {
771771
swap(&mut fg, &mut bg);
772772
}
773773

774-
let mut c = cell.clone();
775-
c.set_fg(fg);
776-
c.set_bg(bg);
777-
778-
(to_rgb(c.fg, 0xffffff), to_rgb(c.bg, 0x000000))
774+
(fg, bg)
779775
}
780776

781777
/// Converts a [`Cell`] into a [`CellData`] for the beamterm renderer.

0 commit comments

Comments
 (0)