From dc9d62b6b1ceb46b660cdd6c3d83bd212ca3942d Mon Sep 17 00:00:00 2001 From: Marc Andre Tanner Date: Sat, 2 Feb 2008 15:01:29 +0100 Subject: [PATCH] Keep status text intact even if it is too long. --- dvtm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dvtm.c b/dvtm.c index a8c1405..98c00b6 100644 --- a/dvtm.c +++ b/dvtm.c @@ -504,21 +504,23 @@ draw_all(bool border){ void drawbar(){ - int s, l; + int s, l, maxlen = width - 2; + char t = stext[maxlen]; if(barpos == BarOff || !*stext) return; curs_set(0); attrset(BAR_ATTR); mvaddch(by, 0, '['); - stext[width - 2] = '\0'; + stext[maxlen] = '\0'; l = strlen(stext); if(BAR_ALIGN_RIGHT) - for(s = 0; s + l < width - 2; s++) + for(s = 0; s + l < maxlen; s++) addch(' '); else - for(; l < width - 2; l++) + for(; l < maxlen; l++) stext[l] = ' '; addstr(stext); + stext[maxlen] = t; addch(']'); attrset(ATTR_NORMAL); if(sel)