Hi,

My first patch! Please be nice.

* src/term/gfxterm.c (grub_virtual_screen_setup): Clear out text_buffer
instead of leaving it uninitialized.

This fixes a 100% reproducible and very annoying bug I've found: Switch to gfxterm and until your clear the screen or scroll, the last position of every line has a random junk character in random foreground and background color. I believe the root cause is that the virtual_screen's text_buffer is uninitialized; as the cursor reaches a new position, the uninitialized junk data is drawn to the screen. Really, the entire screen is junk, but it's never marked dirty so it's never drawn. So let's just clear out the whole text_buffer when we set up the screen.

-joe

-=-=-=-=-=-=-=-=-=-=-=-=-       

--- a/term/gfxterm.c    2009-07-07 16:58:06.000000000 -0700
+++ b/term/gfxterm.c    2009-07-16 15:22:13.000000000 -0700
@@ -225,6 +225,17 @@

  grub_video_set_active_render_target
(GRUB_VIDEO_RENDER_TARGET_DISPLAY);

+  /* Clear out text buffer */
+  unsigned int i;
+  for(i = 0; i < virtual_screen.columns * virtual_screen.rows; i++)
+  {
+      virtual_screen.text_buffer[i].code = ' ';
+      virtual_screen.text_buffer[i].fg_color = virtual_screen.fg_color;
+      virtual_screen.text_buffer[i].bg_color = virtual_screen.bg_color;
+      virtual_screen.text_buffer[i].width = 0;
+      virtual_screen.text_buffer[i].index = 0;
+  }
+
  return grub_errno;
}



_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to