diff -Nurp tin-2.6.2_r3/src/group.c tin-2.6.2_r4/src/group.c --- tin-2.6.2_r3/src/group.c 2021-12-22 14:24:50.000000000 +0100 +++ tin-2.6.2_r4/src/group.c 2022-02-09 20:05:45.000000000 +0100 @@ -1469,7 +1469,11 @@ show_group_title( t_bool clear_title) { char buf[LEN], tmp[LEN], flag; - int i, art_cnt = 0, recent_art_cnt = 0, selected_art_cnt = 0, read_selected_art_cnt = 0, killed_art_cnt = 0; + char *grpname; + int i, len, art_cnt = 0, recent_art_cnt = 0, selected_art_cnt = 0, read_selected_art_cnt = 0, killed_art_cnt = 0; +#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE) + wchar_t *wtmp, *wtmp2; +#endif /* MULTIBYTE_ABLE && !NO_LOCALE */ for_each_art(i) { if (arts[i].thread == ART_EXPIRED) @@ -1502,10 +1506,9 @@ show_group_title( /* * build the group title */ - /* group name and thread count */ - snprintf(buf, sizeof(buf), "%s (%d%c", - curr_group->name, grpmenu.max, - *txt_threading[curr_group->attribute->thread_articles]); + /* thread count */ + snprintf(buf, sizeof(buf), " (%d%c", + grpmenu.max, *txt_threading[curr_group->attribute->thread_articles]); /* article count */ if ((cmdline.args & CMDLINE_GETART_LIMIT) ? cmdline.getart_limit : tinrc.getart_limit) @@ -1553,12 +1556,48 @@ show_group_title( snprintf(tmp, sizeof(tmp), ") %c", flag); if (sizeof(buf) > strlen(buf) + strlen(tmp)) strcat(buf, tmp); + /* + * determine max len for centered group name + * we lose room here due to the leading spaces + * txt_you_have_mail: " You have mail" + * txt_type_h_for_help: " h=help" + */ + len = cCOLS - (2 * MAX(strwidth(_(txt_type_h_for_help)), strwidth(_(txt_you_have_mail))) + strwidth(buf) + 1); + + /* group name */ +#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE) + if ((wtmp = char2wchar_t(curr_group->name)) != NULL) { + if (tinrc.abbreviate_groupname) + wtmp2 = abbr_wcsgroupname(wtmp, len); + else + wtmp2 = wstrunc(wtmp, len); + grpname = wchar_t2char(wtmp2); + free(wtmp); + free(wtmp2); + if (grpname) { + STRCPY(tmp, grpname); + strcat(tmp, buf); + free(grpname); + } else { + STRCPY(tmp, buf); + } + } else + STRCPY(tmp, buf); +#else + if (tinrc.abbreviate_groupname) + grpname = abbr_groupname(curr_group->name, len); + else + grpname = strunc(curr_group->name, len); + STRCPY(tmp, grpname); + strcat(tmp, buf); + free(grpname); +#endif /* MULTIBYTE_ABLE || NO_LOCALE */ if (clear_title) { MoveCursor(0, 0); CleartoEOLN(); } - show_title(buf); + show_title(tmp); }