Blame SOURCES/0273-grub-core-term-i386-pc-console.c-Fix-cursor-moving-a.patch

f96e0b
From c5e950e3eceeb286dbdd4c5c2f3bc53979ad1a1d Mon Sep 17 00:00:00 2001
f96e0b
From: Andrey Borzenkov <arvidjaar@gmail.com>
f96e0b
Date: Mon, 8 Apr 2013 19:51:33 +0200
f96e0b
Subject: [PATCH 273/482] 	* grub-core/term/i386/pc/console.c: Fix cursor
f96e0b
 moving algorithm.
f96e0b
f96e0b
---
f96e0b
 ChangeLog                        |  4 ++++
f96e0b
 grub-core/term/i386/pc/console.c | 24 +++++++++---------------
f96e0b
 2 files changed, 13 insertions(+), 15 deletions(-)
f96e0b
f96e0b
diff --git a/ChangeLog b/ChangeLog
f96e0b
index 3a241c0..9e08bea 100644
f96e0b
--- a/ChangeLog
f96e0b
+++ b/ChangeLog
f96e0b
@@ -1,3 +1,7 @@
f96e0b
+2013-04-08  Andrey Borzenkov <arvidjaar@gmail.com>
f96e0b
+
f96e0b
+	* grub-core/term/i386/pc/console.c: Fix cursor moving algorithm.
f96e0b
+
f96e0b
 2013-04-08  Bryan Hundven <bryanhundven@gmail.com>
f96e0b
 
f96e0b
 	* docs/grub-dev.texi: Move @itemize after @subsection to satisfy
f96e0b
diff --git a/grub-core/term/i386/pc/console.c b/grub-core/term/i386/pc/console.c
f96e0b
index ee6650b..358611a 100644
f96e0b
--- a/grub-core/term/i386/pc/console.c
f96e0b
+++ b/grub-core/term/i386/pc/console.c
f96e0b
@@ -86,13 +86,9 @@ grub_console_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
f96e0b
  * Put the character C on the console. Because GRUB wants to write a
f96e0b
  * character with an attribute, this implementation is a bit tricky.
f96e0b
  * If C is a control character (CR, LF, BEL, BS), use INT 10, AH = 0Eh
f96e0b
- * (TELETYPE OUTPUT). Otherwise, save the original position, put a space,
f96e0b
- * save the current position, restore the original position, write the
f96e0b
- * character and the attribute, and restore the current position.
f96e0b
- *
f96e0b
- * The reason why this is so complicated is that there is no easy way to
f96e0b
- * get the height of the screen, and the TELETYPE OUTPUT BIOS call doesn't
f96e0b
- * support setting a background attribute.
f96e0b
+ * (TELETYPE OUTPUT). Otherwise, use INT 10, AH = 9 to write character
f96e0b
+ * with attributes and advance cursor. If we are on the last column,
f96e0b
+ * let BIOS to wrap line correctly.
f96e0b
  */
f96e0b
 static void
f96e0b
 grub_console_putchar_real (grub_uint8_t c)
f96e0b
@@ -112,19 +108,18 @@ grub_console_putchar_real (grub_uint8_t c)
f96e0b
   /* get the current position */
f96e0b
   pos = grub_console_getxy (NULL);
f96e0b
   
f96e0b
+  /* write the character with the attribute */
f96e0b
+  int10_9 (c, 1);
f96e0b
+
f96e0b
   /* check the column with the width */
f96e0b
   if ((pos & 0xff00) >= (79 << 8))
f96e0b
     {
f96e0b
       grub_console_putchar_real (0x0d);
f96e0b
       grub_console_putchar_real (0x0a);
f96e0b
-      /* get the current position */
f96e0b
-      pos = grub_console_getxy (NULL);
f96e0b
     }
f96e0b
+  else
f96e0b
+    grub_console_gotoxy (NULL, ((pos & 0xff00) >> 8) + 1, (pos & 0xff));
f96e0b
 
f96e0b
-  /* write the character with the attribute */
f96e0b
-  int10_9 (c, 1);
f96e0b
-
f96e0b
-  grub_console_gotoxy (NULL, ((pos & 0xff00) >> 8) + 1, (pos & 0xff));
f96e0b
 }
f96e0b
 
f96e0b
 static void
f96e0b
@@ -255,8 +250,7 @@ grub_console_getkeystatus (struct grub_term_input *term __attribute__ ((unused))
f96e0b
 static grub_uint16_t
f96e0b
 grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
f96e0b
 {
f96e0b
-  /* Due to current cursor moving algorithm we lost the last column.  */
f96e0b
-  return (79 << 8) | 25;
f96e0b
+  return (80 << 8) | 25;
f96e0b
 }
f96e0b
 
f96e0b
 static void
f96e0b
-- 
f96e0b
1.8.2.1
f96e0b