if (setupterm(0, fileno(tty->fp), &err) != OK || err < 1) return (-1);
tty->cap.cr = tigetstr("cr");
if (setupterm(0, fileno(tty->fp), &err) != OK || err < 1) return (-1);
tty->cap.cr = tigetstr("cr");
tty->cap.up = tigetstr("cuu1");
tty->cap.ce = tigetstr("el");
tty->cap.cd = tigetstr("ed");
tty->cap.up = tigetstr("cuu1");
tty->cap.ce = tigetstr("el");
tty->cap.cd = tigetstr("ed");
tty->cap.up = tgetstr("up", &capcur);
tty->cap.ce = tgetstr("ce", &capcur);
tty->cap.cd = tgetstr("cd", &capcur);
tty->cap.up = tgetstr("up", &capcur);
tty->cap.ce = tgetstr("ce", &capcur);
tty->cap.cd = tgetstr("cd", &capcur);
if (!tty->cap.up || !tty->cap.ce || !tty->cap.cd)
{ fclose(tty->fp); tty->fp = 0; return (-1); }
if (!tty->cap.af || !tty->cap.ab || !tty->cap.op) tty->cap.op = 0;
if (!tty->cap.up || !tty->cap.ce || !tty->cap.cd)
{ fclose(tty->fp); tty->fp = 0; return (-1); }
if (!tty->cap.af || !tty->cap.ab || !tty->cap.op) tty->cap.op = 0;
clear_progress(progress, &render, 0);
for (item = progress->items; item; item = item->next) {
clear_progress(progress, &render, 0);
for (item = progress->items; item; item = item->next) {
render.leftsz = render.rightsz = 0;
render.leftwd = render.rightwd = 0;
item->render(item, &render); progress->last_lines++; f |= f_any;
if (progress->last_lines > render.height) break;
}
render.leftsz = render.rightsz = 0;
render.leftwd = render.rightwd = 0;
item->render(item, &render); progress->last_lines++; f |= f_any;
if (progress->last_lines > render.height) break;
}