Received: from list by lists.gnu.org with archive (Exim 4.71) id 1U8YuL-0001e7-QL for mharc-grub-devel@gnu.org; Thu, 21 Feb 2013 11:22:05 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8YuE-0001dR-DX for grub-devel@gnu.org; Thu, 21 Feb 2013 11:22:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8Yu7-0007rw-Rp for grub-devel@gnu.org; Thu, 21 Feb 2013 11:21:58 -0500 Received: from mail-lb0-f181.google.com ([209.85.217.181]:56049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8Yu7-0007ql-Gm for grub-devel@gnu.org; Thu, 21 Feb 2013 11:21:51 -0500 Received: by mail-lb0-f181.google.com with SMTP id gm6so7045416lbb.12 for ; Thu, 21 Feb 2013 08:21:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer; bh=aomHjUJstliWUC8kX7oDu2FYrpzHZgAiF3OCr7Qciws=; b=iVoBXTPlMNM0jd5fFCp9rT2VUieLSVc/ar8vKDKkN/6jEE46VvLmHEeb/ZAanwtvEx OJqpA8qteyVXGMlXx0dbo10DWsyCZRyD5Sqp2kAsb2r8iLN8PK21xMunsuBIn1dwOUJm t4qMmKNth1OTbvM3NL6seDi9Hw1IR7ZVMcq9L6N1vIQyXHAkzAdxmrtAYYK+B5LIyfVV NWKm66mCbGe570bX4FuNpotVL0/mDMBrEsWLUURVM1LkHdoeHy2mebiQkUEtiK5iv8u8 JB3CQFwpv1zwE0nWY47sbxurAdRnPuDyDNOmGJn2bZonmwdaDoq/GOyxS7K+LlgmJp5l 2APQ== X-Received: by 10.112.49.131 with SMTP id u3mr7312464lbn.60.1361463709770; Thu, 21 Feb 2013 08:21:49 -0800 (PST) Received: from localhost.localdomain (ppp79-139-243-180.pppoe.spdop.ru. [79.139.243.180]) by mx.google.com with ESMTPS id m1sm3719990lbh.5.2013.02.21.08.21.48 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Feb 2013 08:21:48 -0800 (PST) From: Andrey Borzenkov To: grub-devel@gnu.org Subject: [PATCH] fix last column in BIOS console Date: Thu, 21 Feb 2013 20:20:23 +0400 Message-Id: <1361463623-25266-1-git-send-email-arvidjaar@gmail.com> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.217.181 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: Thu, 21 Feb 2013 16:22:05 -0000 BIOS console wrapped line at 79 characters. It became the issue after recent changes when extra column for scrolling indications was removed. The effect was that up/down arrows were printed in the first column of the next line. May be it would be easier to simply use INT10 AH=13. Available documentation indicates that it is available since 1986, so I guess any system that exists today should implement it. Signed-off-by: Andrey Borzenkov --- grub-core/term/i386/pc/console.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/grub-core/term/i386/pc/console.c b/grub-core/term/i386/pc/console.c index 2aa1943..358611a 100644 --- a/grub-core/term/i386/pc/console.c +++ b/grub-core/term/i386/pc/console.c @@ -86,13 +86,9 @@ grub_console_gotoxy (struct grub_term_output *term __attribute__ ((unused)), * Put the character C on the console. Because GRUB wants to write a * character with an attribute, this implementation is a bit tricky. * If C is a control character (CR, LF, BEL, BS), use INT 10, AH = 0Eh - * (TELETYPE OUTPUT). Otherwise, save the original position, put a space, - * save the current position, restore the original position, write the - * character and the attribute, and restore the current position. - * - * The reason why this is so complicated is that there is no easy way to - * get the height of the screen, and the TELETYPE OUTPUT BIOS call doesn't - * support setting a background attribute. + * (TELETYPE OUTPUT). Otherwise, use INT 10, AH = 9 to write character + * with attributes and advance cursor. If we are on the last column, + * let BIOS to wrap line correctly. */ static void grub_console_putchar_real (grub_uint8_t c) @@ -112,19 +108,18 @@ grub_console_putchar_real (grub_uint8_t c) /* get the current position */ pos = grub_console_getxy (NULL); + /* write the character with the attribute */ + int10_9 (c, 1); + /* check the column with the width */ if ((pos & 0xff00) >= (79 << 8)) { grub_console_putchar_real (0x0d); grub_console_putchar_real (0x0a); - /* get the current position */ - pos = grub_console_getxy (NULL); } + else + grub_console_gotoxy (NULL, ((pos & 0xff00) >> 8) + 1, (pos & 0xff)); - /* write the character with the attribute */ - int10_9 (c, 1); - - grub_console_gotoxy (NULL, ((pos & 0xff00) >> 8) + 1, (pos & 0xff)); } static void -- tg: (cc35b49..) u/console-last-column (depends on: master)