Make few more points bidi-clean

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-03-23 16:28:35 +01:00
parent ce04e79272
commit 81b0623a6c
2 changed files with 12 additions and 17 deletions

View file

@ -1094,10 +1094,10 @@ complete (struct screen *screen, int continuous, int update)
else
grub_putcode (' ', screen->terms[i].term);
while (*p && p < endp)
grub_putcode (*p++, screen->terms[i].term);
grub_print_ucs4 (p, ucs4 + ucs4len < endp ? ucs4 + ucs4len : endp,
0, 0, screen->terms[i].term);
if (*p)
if (ucs4 + ucs4len > endp)
grub_putcode (GRUB_TERM_DISP_RIGHT, screen->terms[i].term);
grub_term_gotoxy (screen->terms[i].term, pos >> 8, pos & 0xFF);
}

View file

@ -165,17 +165,12 @@ map_code (grub_uint32_t in, struct grub_term_output *term)
void
grub_puts_terminal (const char *str, struct grub_term_output *term)
{
grub_uint32_t code;
grub_ssize_t ret;
const grub_uint8_t *ptr = (const grub_uint8_t *) str;
const grub_uint8_t *end;
end = (const grub_uint8_t *) (str + grub_strlen (str));
grub_uint32_t *unicode_str, *unicode_last_position;
grub_utf8_to_ucs4_alloc (str, &unicode_str,
&unicode_last_position);
while (*ptr)
{
ret = grub_utf8_to_ucs4 (&code, 1, ptr, end - ptr, &ptr);
grub_putcode (code, term);
}
grub_print_ucs4 (unicode_str, unicode_last_position, 0, 0, term);
grub_free (unicode_str);
}
grub_uint16_t *
@ -574,13 +569,13 @@ void
grub_xputs_normal (const char *str)
{
grub_term_output_t term;
FOR_ACTIVE_TERM_OUTPUTS(term)
{
grub_uint32_t *unicode_str, *unicode_last_position;
grub_utf8_to_ucs4_alloc (str, &unicode_str,
&unicode_last_position);
FOR_ACTIVE_TERM_OUTPUTS(term)
{
grub_print_ucs4 (unicode_str, unicode_last_position, 0, 0, term);
}
grub_free (unicode_str);
}
}