]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/normal/term.c: Few more fixes for menu entry editor
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 8 Apr 2013 12:35:26 +0000 (14:35 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 8 Apr 2013 12:35:26 +0000 (14:35 +0200)
rendering.
Reported by: Andrey Borzenkov <arvidjaar@gmail.com>

ChangeLog
grub-core/normal/menu_entry.c
grub-core/normal/term.c
include/grub/term.h

index 8b90e7a45e058919161d456ab4c1da9864e1aa6d..0c97d42c0c8999fbac595db3980773924bdd9263 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-04-08  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/normal/term.c: Few more fixes for menu entry editor
+       rendering.
+       Reported by: Andrey Borzenkov <arvidjaar@gmail.com>
+
 2013-04-07  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/normal/term.c: Few more fixes for menu entry editor
index 80f9464851588005590434857031a4535c70fd90..e0407aa888876797149cc1b5861b28f84d1a442b 100644 (file)
@@ -118,6 +118,15 @@ ensure_space (struct line *linep, int extra)
   return 1;
 }
 
+/* The max column number of an entry. The last "-1" is for a
+   continuation marker.  */
+static inline int
+grub_term_entry_width (struct grub_term_output *term)
+{
+  return grub_term_border_width (term) - GRUB_TERM_MARGIN * 2 - 2;
+}
+
+
 /* Return the number of lines occupied by this line on the screen.  */
 static int
 get_logical_num_lines (struct line *linep, struct per_term_screen *term_screen)
@@ -150,7 +159,7 @@ print_empty_line (int y, struct per_term_screen *term_screen)
                    GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1,
                    y + GRUB_TERM_FIRST_ENTRY_Y);
 
-  for (i = 0; i < grub_term_entry_width (term_screen->term); i++)
+  for (i = 0; i < grub_term_entry_width (term_screen->term) + 1; i++)
     grub_putcode (' ', term_screen->term);
 }
 
index d73d29c5f2db6cc8e4176cf11dec145975a9366c..f9620f6e5d335142de8d73670d78830a109cef4d 100644 (file)
@@ -787,13 +787,17 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual,
                     grub_uint32_t contchar)
 {
   const struct grub_unicode_glyph *visual_ptr;
+  int since_last_nl = 1;
   for (visual_ptr = visual; visual_ptr < visual + visual_len; visual_ptr++)
     {
-      if (visual_ptr->base == '\n')
-       grub_print_spaces (term, margin_right);
+      if (visual_ptr->base == '\n' && contchar)
+       fill_margin (term, margin_right);
+
       putglyph (visual_ptr, term, fixed_tab);
+      since_last_nl++;
       if (visual_ptr->base == '\n')
        {
+         since_last_nl = 0;
          if (state && ++state->num_lines
              >= (grub_ssize_t) grub_term_height (term) - 2)
            {
@@ -811,6 +815,9 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual,
        }
       grub_free (visual_ptr->combining);
     }
+  if (contchar && since_last_nl)
+       fill_margin (term, margin_right);
+
   return 0;
 }
 
@@ -950,7 +957,7 @@ print_ucs4_real (const grub_uint32_t * str,
       else
        {
          ret = put_glyphs_terminal (visual_show, visual_len_show, margin_left,
-                                    contchar ? 0 : margin_right,
+                                    margin_right,
                                     term, state, fixed_tab, contchar);
 
          if (!ret)
index 655a5e33b9debce0f880943500565723bdb247e5..565d14f7b5719ca93a263e7d231b6be0069d719a 100644 (file)
@@ -347,14 +347,6 @@ grub_term_border_width (struct grub_term_output *term)
   return grub_term_width (term) - GRUB_TERM_MARGIN * 2;
 }
 
-/* The max column number of an entry. The last "-1" is for a
-   continuation marker.  */
-static inline int
-grub_term_entry_width (struct grub_term_output *term)
-{
-  return grub_term_border_width (term) - GRUB_TERM_MARGIN * 2 - 1;
-}
-
 static inline grub_uint16_t
 grub_term_getxy (struct grub_term_output *term)
 {