* grub-core/normal/term.c: Few more fixes for menu entry editor
rendering. Reported by: Andrey Borzenkov <arvidjaar@gmail.com>
This commit is contained in:
parent
a321606813
commit
47043f959f
4 changed files with 26 additions and 12 deletions
|
@ -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>
|
2013-04-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/normal/term.c: Few more fixes for menu entry editor
|
* grub-core/normal/term.c: Few more fixes for menu entry editor
|
||||||
|
|
|
@ -118,6 +118,15 @@ ensure_space (struct line *linep, int extra)
|
||||||
return 1;
|
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. */
|
/* Return the number of lines occupied by this line on the screen. */
|
||||||
static int
|
static int
|
||||||
get_logical_num_lines (struct line *linep, struct per_term_screen *term_screen)
|
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,
|
GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1,
|
||||||
y + GRUB_TERM_FIRST_ENTRY_Y);
|
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);
|
grub_putcode (' ', term_screen->term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -787,13 +787,17 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual,
|
||||||
grub_uint32_t contchar)
|
grub_uint32_t contchar)
|
||||||
{
|
{
|
||||||
const struct grub_unicode_glyph *visual_ptr;
|
const struct grub_unicode_glyph *visual_ptr;
|
||||||
|
int since_last_nl = 1;
|
||||||
for (visual_ptr = visual; visual_ptr < visual + visual_len; visual_ptr++)
|
for (visual_ptr = visual; visual_ptr < visual + visual_len; visual_ptr++)
|
||||||
{
|
{
|
||||||
if (visual_ptr->base == '\n')
|
if (visual_ptr->base == '\n' && contchar)
|
||||||
grub_print_spaces (term, margin_right);
|
fill_margin (term, margin_right);
|
||||||
|
|
||||||
putglyph (visual_ptr, term, fixed_tab);
|
putglyph (visual_ptr, term, fixed_tab);
|
||||||
|
since_last_nl++;
|
||||||
if (visual_ptr->base == '\n')
|
if (visual_ptr->base == '\n')
|
||||||
{
|
{
|
||||||
|
since_last_nl = 0;
|
||||||
if (state && ++state->num_lines
|
if (state && ++state->num_lines
|
||||||
>= (grub_ssize_t) grub_term_height (term) - 2)
|
>= (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);
|
grub_free (visual_ptr->combining);
|
||||||
}
|
}
|
||||||
|
if (contchar && since_last_nl)
|
||||||
|
fill_margin (term, margin_right);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,7 +957,7 @@ print_ucs4_real (const grub_uint32_t * str,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = put_glyphs_terminal (visual_show, visual_len_show, margin_left,
|
ret = put_glyphs_terminal (visual_show, visual_len_show, margin_left,
|
||||||
contchar ? 0 : margin_right,
|
margin_right,
|
||||||
term, state, fixed_tab, contchar);
|
term, state, fixed_tab, contchar);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
|
|
@ -347,14 +347,6 @@ grub_term_border_width (struct grub_term_output *term)
|
||||||
return grub_term_width (term) - GRUB_TERM_MARGIN * 2;
|
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
|
static inline grub_uint16_t
|
||||||
grub_term_getxy (struct grub_term_output *term)
|
grub_term_getxy (struct grub_term_output *term)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue