Received: from list by lists.gnu.org with archive (Exim 4.71) id 1aBbTj-0002bo-Ds for mharc-grub-devel@gnu.org; Tue, 22 Dec 2015 23:56:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBbTh-0002bP-9U for grub-devel@gnu.org; Tue, 22 Dec 2015 23:56:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBbTe-0004cd-3Y for grub-devel@gnu.org; Tue, 22 Dec 2015 23:56:45 -0500 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:43962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBbTd-0004cZ-U9 for grub-devel@gnu.org; Tue, 22 Dec 2015 23:56:42 -0500 Received: from linux-dsax.tai.apac.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (TLS encrypted); Tue, 22 Dec 2015 21:56:25 -0700 Date: Wed, 23 Dec 2015 12:45:06 +0800 From: Michael Chang To: grub-devel@gnu.org Subject: [PATCH] normal: fix get_logical_num_lines Message-ID: <20151223044505.GA28369@linux-dsax.tai.apac.novell.com> Mail-Followup-To: grub-devel@gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.26 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Dec 2015 04:56:46 -0000 In menu editing mode, grub2 shows bogus line if the character being edited is at last column of entry. This patch fixes the problem by having the get_logical_num_lines function to calculate correct number of lines. --- grub-core/normal/menu_entry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c index 62c7e16..1d4b0c6 100644 --- a/grub-core/normal/menu_entry.c +++ b/grub-core/normal/menu_entry.c @@ -128,7 +128,7 @@ 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; + / ((unsigned) term_screen->geo.entry_width + 1)) + 1; } static void -- 2.6.3