1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Use round instead of ceil for line position

Ceiling line position results in strikeout line being lower than
it should.
This commit is contained in:
Kirill Chibisov 2022-03-06 19:34:12 +03:00 committed by GitHub
parent d8113dc2b6
commit dbccd7e30f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -87,7 +87,7 @@ color_t draw_dotted(float_t x, float_t y) {
// Since we use the entire descent area for dotted underlines, we limit its // Since we use the entire descent area for dotted underlines, we limit its
// height to a single pixel so we don't draw bars instead of dots. // height to a single pixel so we don't draw bars instead of dots.
float_t alpha = 1. - abs(floor(underlinePosition - 0.5) - y); float_t alpha = 1. - abs(floor(underlinePosition) - y);
if (int(mod(x, 2.)) != int(cellEven)) { if (int(mod(x, 2.)) != int(cellEven)) {
alpha = 0.; alpha = 0.;
} }

View file

@ -137,7 +137,7 @@ impl RenderLine {
let line_bottom = (start.line as f32 + 1.) * size.cell_height(); let line_bottom = (start.line as f32 + 1.) * size.cell_height();
let baseline = line_bottom + descent; let baseline = line_bottom + descent;
let mut y = (baseline - position - thickness / 2.).ceil(); let mut y = (baseline - position - thickness / 2.).round();
let max_y = line_bottom - thickness; let max_y = line_bottom - thickness;
if y > max_y { if y > max_y {
y = max_y; y = max_y;