31004e6
From a36ddee93b64424dfd6c99fe919910c47a30836f Mon Sep 17 00:00:00 2001
a5bd9f6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
31004e6
Date: Sun, 7 Apr 2013 17:48:22 +0200
f74b50e
Subject: [PATCH 270/482] 	* grub-core/normal/term.c: Few more fixes for
a5bd9f6
 menu entry editor 	rendering. 	Reported by: Andrey Borzenkov
a5bd9f6
 <arvidjaar@gmail.com>
a5bd9f6
a5bd9f6
---
31004e6
 ChangeLog               |  6 ++++++
31004e6
 grub-core/normal/term.c | 24 ++++++++++++++++--------
31004e6
 2 files changed, 22 insertions(+), 8 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
31004e6
index 9163911..8b90e7a 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,3 +1,9 @@
31004e6
+2013-04-07  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
+
a5bd9f6
+	* grub-core/normal/term.c: Few more fixes for menu entry editor
a5bd9f6
+	rendering.
a5bd9f6
+	Reported by: Andrey Borzenkov <arvidjaar@gmail.com>
a5bd9f6
+
31004e6
 2013-04-06  Andrey Borzenkov <arvidjaar@gmail.com>
a5bd9f6
 
31004e6
 	* conf/Makefile.extra-dist (EXTRA_DIST): Add
a5bd9f6
diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c
31004e6
index f05184b..d73d29c 100644
a5bd9f6
--- a/grub-core/normal/term.c
a5bd9f6
+++ b/grub-core/normal/term.c
31004e6
@@ -746,9 +746,12 @@ print_ucs4_terminal (const grub_uint32_t * str,
31004e6
 	  putcode_real (*ptr2, term, fixed_tab);
31004e6
 	}
31004e6
 
31004e6
-      sp = max_width - pos[last_position - str].x + 1;
31004e6
-      if (sp > 0)
31004e6
-	grub_print_spaces (term, sp);
31004e6
+      if (contchar)
31004e6
+	{
31004e6
+	  sp = max_width - pos[last_position - str].x + 1;
31004e6
+	  if (sp > 0)
31004e6
+	    grub_print_spaces (term, sp);
31004e6
+	}
31004e6
     }
31004e6
   return dry_run ? lines : 0;
31004e6
 }
31004e6
@@ -780,7 +783,8 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual,
31004e6
 		     grub_ssize_t visual_len,
31004e6
 		     int margin_left, int margin_right,
31004e6
 		     struct grub_term_output *term,
31004e6
-		     struct term_state *state, int fixed_tab)
31004e6
+		     struct term_state *state, int fixed_tab,
31004e6
+		     grub_uint32_t contchar)
a5bd9f6
 {
a5bd9f6
   const struct grub_unicode_glyph *visual_ptr;
a5bd9f6
   for (visual_ptr = visual; visual_ptr < visual + visual_len; visual_ptr++)
31004e6
@@ -799,7 +803,11 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual,
31004e6
 	      return 1;
31004e6
 	    }
31004e6
 
31004e6
-	  grub_print_spaces (term, margin_left);
31004e6
+	  if (!contchar)
31004e6
+	    grub_print_spaces (term, margin_left);
31004e6
+	  else
31004e6
+	    grub_term_gotoxy (term, margin_left,
31004e6
+			      grub_term_getxy (term) & 0xff);
a5bd9f6
 	}
a5bd9f6
       grub_free (visual_ptr->combining);
a5bd9f6
     }
31004e6
@@ -839,7 +847,7 @@ print_backlog (struct grub_term_output *term,
31004e6
       ret = put_glyphs_terminal (state->backlog_glyphs,
31004e6
 				 state->backlog_len,
31004e6
 				 margin_left, margin_right, term, state,
31004e6
-				 state->backlog_fixed_tab);
31004e6
+				 state->backlog_fixed_tab, 0);
31004e6
       if (!ret)
31004e6
 	{
31004e6
 	  grub_free (state->free);
31004e6
@@ -942,8 +950,8 @@ print_ucs4_real (const grub_uint32_t * str,
a5bd9f6
       else
a5bd9f6
 	{
a5bd9f6
 	  ret = put_glyphs_terminal (visual_show, visual_len_show, margin_left,
31004e6
-				     contchar ? margin_right : 1,
31004e6
-				     term, state, fixed_tab);
31004e6
+				     contchar ? 0 : margin_right,
31004e6
+				     term, state, fixed_tab, contchar);
a5bd9f6
 
a5bd9f6
 	  if (!ret)
31004e6
 	    grub_free (visual);
a5bd9f6
-- 
31004e6
1.8.2.1
a5bd9f6