From: Christian Heller Date: Thu, 2 May 2013 02:46:22 +0000 (+0200) Subject: Repaired buggy window title display. X-Git-Tag: tce~1322 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Byoutube_prefix%7D%7D%7B%7Bvideo_data.id_%7D%7D?a=commitdiff_plain;h=47ba3228624b18452e47de53e33ac8c3095319a5;p=plomrogue Repaired buggy window title display. --- diff --git a/windows.c b/windows.c index 8b82d60..31da833 100644 --- a/windows.c +++ b/windows.c @@ -121,10 +121,11 @@ void draw_window_borders (struct Win * win, char active) { mvwaddch(wgetparent(win->curses_win), getbegy(win->curses_win) - 1, x, '-'); mvwaddch(wgetparent(win->curses_win), getbegy(win->curses_win) + win->height, x, '-'); } char min_title_length_visible = 3; // 1 char minimal, plus 2 chars for decoration left/right of title - if (win->width > min_title_length_visible) { - int title_length = strlen(win->title); - int title_offset = (((win->width) - (title_length + 2)) / 2); // + 2 is for decoration - int length_visible = strnlen(win->title, win->width - min_title_length_visible); + if (win->width >= min_title_length_visible) { + int title_offset = 0; + if (win->width > strlen(win->title) + 2) + title_offset = (win->width - (strlen(win->title) + 2)) / 2; // + 2 is for decoration + int length_visible = strnlen(win->title, win->width - 2); char title[length_visible + 3]; char decoration = ' '; if (1 == active)