1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-20 11:17:15 +03:00

fixup underlines

bd47979292 made underlines only as
wide as the glyph texture.

This commit renders them under the width of the cluster region.
This commit is contained in:
Wez Furlong 2022-02-05 16:20:27 -07:00
parent 8cb74c62d2
commit 1f6764f792

View File

@ -1879,6 +1879,29 @@ impl super::TermWindow {
quad.set_hsv(hsv);
}
}
// Underlines
if item.style.underline_tex_rect != params.white_space {
// Draw one per cell, otherwise curly underlines
// stretch across the whole span
for i in 0..cluster_width {
let mut quad = layers[0].allocate()?;
let x = gl_x
+ params.left_pixel_x
+ if params.use_pixel_positioning {
item.x_pos
} else {
phys(cluster.first_cell_idx + i, num_cols, direction) as f32
* cell_width
};
quad.set_position(x, pos_y, x + cell_width, pos_y + cell_height);
quad.set_hsv(hsv);
quad.set_has_color(false);
quad.set_texture(item.style.underline_tex_rect);
quad.set_fg_color(item.style.underline_color);
}
}
}
// Render the selection background color.
@ -2151,21 +2174,6 @@ impl super::TermWindow {
continue;
}
// Underlines
if style_params.underline_tex_rect != params.white_space {
let mut quad = layers[0].allocate()?;
quad.set_position(
gl_x + range.start,
pos_y,
gl_x + range.end,
pos_y + cell_height,
);
quad.set_hsv(hsv);
quad.set_has_color(false);
quad.set_texture(style_params.underline_tex_rect);
quad.set_fg_color(style_params.underline_color);
}
let pixel_rect = euclid::rect(
texture.coords.origin.x + (range.start - (pos_x + adjust)) as isize,
texture.coords.origin.y,