X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fplugins%2Ftitler%2Ftitlerwindow.C;h=74a4aadf883bf968396c6ec6c8620137612dbbbf;hp=d44140607b00556445ca58ebc54aac3933502b4d;hb=58d99c74e65066486dbebf7e1cb3087e7de1c92b;hpb=4c1a91d9f9373e564ecbeb8f568e4a3e7fe48e64 diff --git a/cinelerra-5.1/plugins/titler/titlerwindow.C b/cinelerra-5.1/plugins/titler/titlerwindow.C index d4414060..74a4aadf 100644 --- a/cinelerra-5.1/plugins/titler/titlerwindow.C +++ b/cinelerra-5.1/plugins/titler/titlerwindow.C @@ -681,7 +681,7 @@ void TitleWindow::update_justification() void TitleWindow::update_stats() { text_chars->update(client->config.wlen); - int len = MESSAGESIZE-16 - strlen(text->get_text()); + int len = MESSAGESIZE - BCTEXTLEN - strlen(text->get_text()) - 1; if( len < 0 ) len = 0; text_bfrsz->update(len); } @@ -1064,6 +1064,18 @@ int TitleText::button_press_event() int TitleText::handle_event() { window->fonts_popup->deactivate(); + int text_len = strlen(get_text()); + int avail = MESSAGESIZE - BCTEXTLEN; + if( text_len >= avail ) { // back off last utf8 char + char text[2*sizeof(client->config.wtext)]; + strcpy(text, get_text()); + text_len = avail; + while( text_len > 0 && (text[text_len-1] & 0xc0) == 0x80 ) + text[--text_len] = 0; + if( text_len > 0 ) + text[--text_len] = 0; + update(text); + } int len = sizeof(client->config.wtext) / sizeof(wchar_t); wcsncpy(client->config.wtext, get_wtext(), len); client->config.wtext[len-1] = 0; @@ -1411,7 +1423,7 @@ int TitleCurPopup::handle_event() return 1; } -void TitleCurSubMenu::add_subitem(int popup_type, va_list ap, const char *fmt) +void TitleCurSubMenu::add_subitemx(int popup_type, va_list ap, const char *fmt) { char item[BCSTRLEN]; vsnprintf(item, sizeof(item)-1, fmt, ap);