Skip to content

Commit

Permalink
Use round instead of ceil for line position
Browse files Browse the repository at this point in the history
Ceiling line position results in strikeout line being lower than
it should.
  • Loading branch information
kchibisov committed Mar 6, 2022
1 parent d8113dc commit dbccd7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion alacritty/res/rect.f.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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
// 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)) {
alpha = 0.;
}
Expand Down
2 changes: 1 addition & 1 deletion alacritty/src/renderer/rects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl RenderLine {
let line_bottom = (start.line as f32 + 1.) * size.cell_height();
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;
if y > max_y {
y = max_y;
Expand Down

0 comments on commit dbccd7e

Please sign in to comment.