2005-08-21 Yoshinori K. Okuji <okuji@enbug.org>

* util/console.c (grub_ncurses_putchar): If C is greater than
        0x7f, set C to a question mark.
        (grub_ncurses_getcharwidth): New function.
        (grub_ncurses_term): Specify grub_ncurses_getcharwidth as
        getcharwidth.

        * normal/menu.c (print_entry): Made aware of Unicode. First,
        convert TITLE to UCS-4, and predict the cursor position by
        grub_getcharwidth.

        * include/grub/misc.h (grub_utf8_to_ucs4): Specify the qualifier
        const to SRC.
        * kern/misc.c (grub_utf16_to_utf8): Likewise.
This commit is contained in:
okuji 2005-08-21 07:22:51 +00:00
parent 16ccb8b138
commit 385c6a92a3
5 changed files with 72 additions and 13 deletions

View file

@ -80,12 +80,21 @@ grub_ncurses_putchar (grub_uint32_t c)
break;
default:
/* ncurses does not support Unicode. */
if (c > 0x7f)
c = '?';
break;
}
addch (c | grub_console_attr);
}
static grub_ssize_t
grub_ncurses_getcharwidth (grub_uint32_t code __attribute__ ((unused)))
{
return 1;
}
static void
grub_ncurses_setcolorstate (grub_term_color_state state)
{
@ -283,6 +292,7 @@ static struct grub_term grub_ncurses_term =
.init = grub_ncurses_init,
.fini = grub_ncurses_fini,
.putchar = grub_ncurses_putchar,
.getcharwidth = grub_ncurses_getcharwidth,
.checkkey = grub_ncurses_checkkey,
.getkey = grub_ncurses_getkey,
.getxy = grub_ncurses_getxy,