|
|
a5bd9f6 |
From 4e8d4c0c9af6f05c4b7a9d64baaf846449624068 Mon Sep 17 00:00:00 2001
|
|
|
a5bd9f6 |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
Date: Mon, 8 Apr 2013 14:35:26 +0200
|
|
|
a5bd9f6 |
Subject: [PATCH 270/364] * grub-core/normal/term.c: Few more fixes for
|
|
|
a5bd9f6 |
menu entry editor rendering. Reported by: Andrey Borzenkov
|
|
|
a5bd9f6 |
<arvidjaar@gmail.com>
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
---
|
|
|
a5bd9f6 |
ChangeLog | 6 ++++++
|
|
|
a5bd9f6 |
grub-core/normal/menu_entry.c | 11 ++++++++++-
|
|
|
a5bd9f6 |
grub-core/normal/term.c | 13 ++++++++++---
|
|
|
a5bd9f6 |
include/grub/term.h | 8 --------
|
|
|
a5bd9f6 |
4 files changed, 26 insertions(+), 12 deletions(-)
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
diff --git a/ChangeLog b/ChangeLog
|
|
|
a5bd9f6 |
index 8b90e7a..0c97d42 100644
|
|
|
a5bd9f6 |
--- a/ChangeLog
|
|
|
a5bd9f6 |
+++ b/ChangeLog
|
|
|
a5bd9f6 |
@@ -1,3 +1,9 @@
|
|
|
a5bd9f6 |
+2013-04-08 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 |
+
|
|
|
a5bd9f6 |
2013-04-07 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
* grub-core/normal/term.c: Few more fixes for menu entry editor
|
|
|
a5bd9f6 |
diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c
|
|
|
a5bd9f6 |
index 80f9464..e0407aa 100644
|
|
|
a5bd9f6 |
--- a/grub-core/normal/menu_entry.c
|
|
|
a5bd9f6 |
+++ b/grub-core/normal/menu_entry.c
|
|
|
a5bd9f6 |
@@ -118,6 +118,15 @@ ensure_space (struct line *linep, int extra)
|
|
|
a5bd9f6 |
return 1;
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
+/* The max column number of an entry. The last "-1" is for a
|
|
|
a5bd9f6 |
+ continuation marker. */
|
|
|
a5bd9f6 |
+static inline int
|
|
|
a5bd9f6 |
+grub_term_entry_width (struct grub_term_output *term)
|
|
|
a5bd9f6 |
+{
|
|
|
a5bd9f6 |
+ return grub_term_border_width (term) - GRUB_TERM_MARGIN * 2 - 2;
|
|
|
a5bd9f6 |
+}
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
/* Return the number of lines occupied by this line on the screen. */
|
|
|
a5bd9f6 |
static int
|
|
|
a5bd9f6 |
get_logical_num_lines (struct line *linep, struct per_term_screen *term_screen)
|
|
|
a5bd9f6 |
@@ -150,7 +159,7 @@ print_empty_line (int y, struct per_term_screen *term_screen)
|
|
|
a5bd9f6 |
GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1,
|
|
|
a5bd9f6 |
y + GRUB_TERM_FIRST_ENTRY_Y);
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
- for (i = 0; i < grub_term_entry_width (term_screen->term); i++)
|
|
|
a5bd9f6 |
+ for (i = 0; i < grub_term_entry_width (term_screen->term) + 1; i++)
|
|
|
a5bd9f6 |
grub_putcode (' ', term_screen->term);
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c
|
|
|
a5bd9f6 |
index d73d29c..f9620f6 100644
|
|
|
a5bd9f6 |
--- a/grub-core/normal/term.c
|
|
|
a5bd9f6 |
+++ b/grub-core/normal/term.c
|
|
|
a5bd9f6 |
@@ -787,13 +787,17 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual,
|
|
|
a5bd9f6 |
grub_uint32_t contchar)
|
|
|
a5bd9f6 |
{
|
|
|
a5bd9f6 |
const struct grub_unicode_glyph *visual_ptr;
|
|
|
a5bd9f6 |
+ int since_last_nl = 1;
|
|
|
a5bd9f6 |
for (visual_ptr = visual; visual_ptr < visual + visual_len; visual_ptr++)
|
|
|
a5bd9f6 |
{
|
|
|
a5bd9f6 |
- if (visual_ptr->base == '\n')
|
|
|
a5bd9f6 |
- grub_print_spaces (term, margin_right);
|
|
|
a5bd9f6 |
+ if (visual_ptr->base == '\n' && contchar)
|
|
|
a5bd9f6 |
+ fill_margin (term, margin_right);
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
putglyph (visual_ptr, term, fixed_tab);
|
|
|
a5bd9f6 |
+ since_last_nl++;
|
|
|
a5bd9f6 |
if (visual_ptr->base == '\n')
|
|
|
a5bd9f6 |
{
|
|
|
a5bd9f6 |
+ since_last_nl = 0;
|
|
|
a5bd9f6 |
if (state && ++state->num_lines
|
|
|
a5bd9f6 |
>= (grub_ssize_t) grub_term_height (term) - 2)
|
|
|
a5bd9f6 |
{
|
|
|
a5bd9f6 |
@@ -811,6 +815,9 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual,
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
grub_free (visual_ptr->combining);
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
+ if (contchar && since_last_nl)
|
|
|
a5bd9f6 |
+ fill_margin (term, margin_right);
|
|
|
a5bd9f6 |
+
|
|
|
a5bd9f6 |
return 0;
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
@@ -950,7 +957,7 @@ print_ucs4_real (const grub_uint32_t * str,
|
|
|
a5bd9f6 |
else
|
|
|
a5bd9f6 |
{
|
|
|
a5bd9f6 |
ret = put_glyphs_terminal (visual_show, visual_len_show, margin_left,
|
|
|
a5bd9f6 |
- contchar ? 0 : margin_right,
|
|
|
a5bd9f6 |
+ margin_right,
|
|
|
a5bd9f6 |
term, state, fixed_tab, contchar);
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
if (!ret)
|
|
|
a5bd9f6 |
diff --git a/include/grub/term.h b/include/grub/term.h
|
|
|
a5bd9f6 |
index 655a5e3..565d14f 100644
|
|
|
a5bd9f6 |
--- a/include/grub/term.h
|
|
|
a5bd9f6 |
+++ b/include/grub/term.h
|
|
|
a5bd9f6 |
@@ -347,14 +347,6 @@ grub_term_border_width (struct grub_term_output *term)
|
|
|
a5bd9f6 |
return grub_term_width (term) - GRUB_TERM_MARGIN * 2;
|
|
|
a5bd9f6 |
}
|
|
|
a5bd9f6 |
|
|
|
a5bd9f6 |
-/* The max column number of an entry. The last "-1" is for a
|
|
|
a5bd9f6 |
- continuation marker. */
|
|
|
a5bd9f6 |
-static inline int
|
|
|
a5bd9f6 |
-grub_term_entry_width (struct grub_term_output *term)
|
|
|
a5bd9f6 |
-{
|
|
|
a5bd9f6 |
- return grub_term_border_width (term) - GRUB_TERM_MARGIN * 2 - 1;
|
|
|
a5bd9f6 |
-}
|
|
|
a5bd9f6 |
-
|
|
|
a5bd9f6 |
static inline grub_uint16_t
|
|
|
a5bd9f6 |
grub_term_getxy (struct grub_term_output *term)
|
|
|
a5bd9f6 |
{
|
|
|
a5bd9f6 |
--
|
|
|
a5bd9f6 |
1.8.1.4
|
|
|
a5bd9f6 |
|