menu: fix line count calculation for long lines
It gave one extra screen line if length was exactly equal to screen width. Reported by Michael Chang. Also-By: Michael Chang <mchang@suse.com>
This commit is contained in:
parent
dbab354157
commit
93ecc3f1f8
1 changed files with 7 additions and 3 deletions
|
@ -126,9 +126,13 @@ ensure_space (struct line *linep, int extra)
|
|||
static int
|
||||
get_logical_num_lines (struct line *linep, struct per_term_screen *term_screen)
|
||||
{
|
||||
return (grub_getstringwidth (linep->buf, linep->buf + linep->len,
|
||||
term_screen->term)
|
||||
/ (unsigned) term_screen->geo.entry_width) + 1;
|
||||
grub_size_t width = grub_getstringwidth (linep->buf, linep->buf + linep->len,
|
||||
term_screen->term);
|
||||
|
||||
/* Empty line still consumes space on screen */
|
||||
return width ? (width + (unsigned) term_screen->geo.entry_width - 1) /
|
||||
(unsigned) term_screen->geo.entry_width
|
||||
: 1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue