gfxterm: Fix clearing of cursor.
If ascent is bigger than height - 2, then we draw over character box but then to clear cursor we only draw over character box. So trim ascent if necessarry.
This commit is contained in:
parent
a134ef1ab9
commit
6f5aa28bc2
1 changed files with 7 additions and 1 deletions
|
@ -668,6 +668,7 @@ draw_cursor (int show)
|
||||||
unsigned int y;
|
unsigned int y;
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
unsigned int height;
|
unsigned int height;
|
||||||
|
unsigned int ascent;
|
||||||
grub_video_color_t color;
|
grub_video_color_t color;
|
||||||
|
|
||||||
write_char ();
|
write_char ();
|
||||||
|
@ -679,13 +680,18 @@ draw_cursor (int show)
|
||||||
>= virtual_screen.rows)
|
>= virtual_screen.rows)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Ensure that cursor doesn't go outside of character box. */
|
||||||
|
ascent = grub_font_get_ascent(virtual_screen.font);
|
||||||
|
if (ascent > virtual_screen.normal_char_height - 2)
|
||||||
|
ascent = virtual_screen.normal_char_height - 2;
|
||||||
|
|
||||||
/* Determine cursor properties and position on text layer. */
|
/* Determine cursor properties and position on text layer. */
|
||||||
x = virtual_screen.cursor_x * virtual_screen.normal_char_width;
|
x = virtual_screen.cursor_x * virtual_screen.normal_char_width;
|
||||||
width = virtual_screen.normal_char_width;
|
width = virtual_screen.normal_char_width;
|
||||||
color = virtual_screen.fg_color;
|
color = virtual_screen.fg_color;
|
||||||
y = ((virtual_screen.cursor_y + virtual_screen.total_scroll)
|
y = ((virtual_screen.cursor_y + virtual_screen.total_scroll)
|
||||||
* virtual_screen.normal_char_height
|
* virtual_screen.normal_char_height
|
||||||
+ grub_font_get_ascent (virtual_screen.font));
|
+ ascent);
|
||||||
height = 2;
|
height = 2;
|
||||||
|
|
||||||
/* Render cursor to text layer. */
|
/* Render cursor to text layer. */
|
||||||
|
|
Loading…
Reference in a new issue