Index: apps/recorder/keyboard.c =================================================================== --- apps/recorder/keyboard.c (revision 22838) +++ apps/recorder/keyboard.c (working copy) @@ -98,6 +98,7 @@ int nchars; int font_w; int font_h; + int text_w; struct font* font; int curfont; int main_x; @@ -291,7 +292,6 @@ struct keyboard_parameters * const param = kbd_param; #endif int l; /* screen loop variable */ - int text_w = 0; int editpos; /* Edit position on all screens */ const int statusbar_size = 0; unsigned short ch; @@ -406,9 +406,12 @@ /* find max width of keyboard glyphs */ for (i = 0; i < pm->nchars; i++) { - w = font_get_width(pm->font, pm->kbd_buf[i]); - if ( w > pm->font_w ) - pm->font_w = w; + if (pm->kbd_buf[i] != '\n') + { + w = font_get_width(pm->font, pm->kbd_buf[i]); + if ( w > pm->font_w ) + pm->font_w = w; + } } /* Since we're going to be adding spaces, make sure that we check @@ -476,19 +479,18 @@ { struct keyboard_parameters *pm = ¶m[l]; struct screen *sc = &screens[l]; + int w; - text_w = pm->font_w; - + pm->text_w = pm->font_w; while (*utf8) { - int w = font_get_width(pm->font, ch); utf8 = (unsigned char*)utf8decode(utf8, &ch); - - if (w > text_w) - text_w = w; + w = font_get_width(pm->font, ch); + if (w > pm->text_w) + pm->text_w = w; } - pm->max_chars_text = sc->getwidth() / text_w - 2; + pm->max_chars_text = sc->getwidth() / pm->text_w - 2; /* Calculate keyboard grid size */ pm->max_chars = sc->getwidth() / pm->font_w; @@ -644,6 +646,7 @@ struct keyboard_parameters *pm = ¶m[l]; struct screen *sc = &screens[l]; int i = 0, j = 0; + int text_w = pm->text_w; /* Clear text area one pixel above separator line so any overdraw doesn't collide */ @@ -662,8 +665,6 @@ pm->leftpos = editpos - pm->curpos; utf8 = text + utf8seek(text, pm->leftpos); - text_w = pm->font_w; - while (*utf8 && i < pm->max_chars_text) { outline[j++] = *utf8++;