From 1bfe49b1fedfdadc98aec4988bc918a1c2cfdc48538e56a879aa325e1dd7b455 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Mon, 11 Jan 2016 03:23:17 +0000 Subject: [PATCH] Accepting request 352681 from home:arvidjaar:bnc:943585 - 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 --- ...ine-count-calculation-for-long-lines.patch | 38 +++++++++++++++++++ grub2.changes | 5 +++ grub2.spec | 2 + 3 files changed, 45 insertions(+) create mode 100644 0001-menu-fix-line-count-calculation-for-long-lines.patch diff --git a/0001-menu-fix-line-count-calculation-for-long-lines.patch b/0001-menu-fix-line-count-calculation-for-long-lines.patch new file mode 100644 index 0000000..f50a0bf --- /dev/null +++ b/0001-menu-fix-line-count-calculation-for-long-lines.patch @@ -0,0 +1,38 @@ +From 7c1f98869a1aedc2210c4d9e5ad9828eeb2dda72 Mon Sep 17 00:00:00 2001 +From: Andrei Borzenkov +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 +--- + 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 + diff --git a/grub2.changes b/grub2.changes index 0c87528..53baeef 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Mon 28 16:53:54 UTC 2015 - arvidjaar@gmail.com + +- Add 0001-menu-fix-line-count-calculation-for-long-lines.patch (bsc#943585) + ------------------------------------------------------------------- Thu Dec 17 11:04:06 UTC 2015 - olaf@aepfle.de diff --git a/grub2.spec b/grub2.spec index 7d8bebb..be9d2fe 100644 --- a/grub2.spec +++ b/grub2.spec @@ -206,6 +206,7 @@ Patch69: grub2-getroot-fix-get-btrfs-fs-prefix-big-endian.patch Patch70: grub2-default-distributor.patch Patch71: grub2-menu-unrestricted.patch Patch72: 0001-Fix-security-issue-when-reading-username-and-passwor.patch +Patch73: 0001-menu-fix-line-count-calculation-for-long-lines.patch # Btrfs snapshot booting related patches Patch101: grub2-btrfs-01-add-ability-to-boot-from-subvolumes.patch Patch102: grub2-btrfs-02-export-subvolume-envvars.patch @@ -481,6 +482,7 @@ mv po/grub.pot po/%{name}.pot %patch70 -p1 %patch71 -p1 %patch72 -p1 +%patch73 -p1 %patch101 -p1 %patch102 -p1 %patch103 -p1