Skip to content

Commit

Permalink
Keep status text intact even if it is too long.
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Feb 2, 2008
1 parent 5bbbe32 commit dc9d62b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dvtm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dc9d62b

Please sign in to comment.