Fix top line of hollow block cursor 1px too high

This commit is contained in:
Kovid Goyal 2018-01-19 16:23:47 +05:30
parent 44a413df81
commit aff1abdb26
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -524,7 +524,16 @@ collect_cursor_info(CursorRenderInfo *ans, Window *w, double now, OSWindow *os_w
unsigned long mult = MAX(1, screen_current_char_width(rd->screen));
double right = left + (ans->shape == CURSOR_BEAM ? cursor_width(1.5, true, os_window) : rd->dx * mult);
double bottom = top - rd->dy;
if (ans->shape == CURSOR_UNDERLINE) top = bottom + cursor_width(2.0, false, os_window);
switch (ans->shape) {
case CURSOR_UNDERLINE:
top = bottom + cursor_width(2.0, false, os_window);
break;
case CURSOR_BLOCK:
top -= 2.0 / os_window->viewport_height; // 1px adjustment for width of line
break;
default:
break;
}
ans->left = left; ans->right = right; ans->top = top; ans->bottom = bottom;
}