1bfe49b1fe
- Add 0001-menu-fix-line-count-calculation-for-long-lines.patch (bsc#943585) OBS-URL: https://build.opensuse.org/request/show/352681 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=198
39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
From 7c1f98869a1aedc2210c4d9e5ad9828eeb2dda72 Mon Sep 17 00:00:00 2001
|
|
From: Andrei Borzenkov <arvidjaar@gmail.com>
|
|
Date: Mon, 28 Dec 2015 19:48:44 +0300
|
|
Subject: [PATCH] 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>
|
|
---
|
|
grub-core/normal/menu_entry.c | 10 +++++++---
|
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c
|
|
index 62c7e16..2b73225 100644
|
|
--- a/grub-core/normal/menu_entry.c
|
|
+++ b/grub-core/normal/menu_entry.c
|
|
@@ -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
|
|
--
|
|
1.9.1
|
|
|